July 25, 2024

Josie Yunker

Digital Innovation

Which Machine Learning Algorithm Do I Use When?


Machine learning is a powerful tool, but it’s not the right tool for every problem. In this article, we’ll discuss some common scenarios in which you might use machine learning algorithms and give some suggestions for when to use each one.

Use Naive Bayes When You Have a Large Number of Features

If you have a large number of features, Naive Bayes is the best choice.

Naive Bayes is a probabilistic learning algorithm that makes predictions based on the conditional probability of an event. It’s useful when you have a large number of features and want to make predictions based on those features.

Use SVM When You Have a Small Number of Features

If you have a small number of features, use SVM.

SVM is a supervised learning algorithm that can be used as a binary classifier or regression model. It finds patterns in data that are linearly separable, meaning that each point can be separated by a straight line with no more than one feature (or axis) on either side of it. The advantage of this is that it makes your model easier to interpret because there aren’t any hidden layers or variables; everything has an explicit purpose and meaning behind it–which makes debugging easier too!

However, SVM isn’t good at finding patterns in non-linear data sets–for example: if someone’s age ranges from 25-30 years old but they want to know whether they should buy insurance policies at 26 years old versus 27 years old…this would be difficult for an SVM classifier because those two ages aren’t linearly separable!

Use Random Forest When Your Data Is Very Unbalanced

If your data is very unbalanced, use random forest.

When you have many features and a small number of features, use random forest.

Use KNN/KMeans If You’re Looking for Clusters

The KNN algorithm is a simple and effective way of finding clusters in data. It’s often used as an alternative to KMeans clustering, which we’ll discuss later on in this article.

KNN works by comparing new data points with existing ones, and then classifying them accordingly. Let’s say you have some customer information stored in an Excel spreadsheet: name email address phone number city state zipcode age gender affiliation (e.g., student) If you wanted to use KNN on this dataset so that every time someone filled out their details on your website or app they would be assigned into one of five categories (e-commerce customer, B2B prospect etc), here how would go about doing it:

  • First step: Identify which attributes are most relevant for dividing the customers into groups – these will define what type of groups exist within your dataset (in our example above these might include things like age range). The more variables involved here will give better results but also require more processing power from your computer/server/cloud service provider etc.;
  • Second step: For each prospective customer enter their values into columns A through E above;
  • Third step: Look up all other entries that are closest matches according to Euclidean distance metrics between each pairings – these will become “neighbors” who share similar characteristics with respect certain attributes such as age range or gender demographics etc.;

There are many machine learning algorithms. They all have different strengths and weaknesses, so you should use them in ways that play to those strengths or help mitigate their weaknesses.

There are many machine learning algorithms. They all have different strengths and weaknesses, so you should use them in ways that play to those strengths or help mitigate their weaknesses.

Here are some examples of how to do this:


So, there you have it! We’ve covered the basics of four machine learning algorithms and why they work well in certain situations. If you want to learn more about these algorithms and how they work, check out our guides on Naive Bayes, SVM and Random Forest.