Published in


AI/ML Introduction: Episode #11: Which Machine Learning Algorithm Should You Use ?

Machine learning algorithm can be used for a wide range of tasks, from predicting stock prices to identifying objects in an image.

For example, Face recognition algorithms can be used to identify people in security systems by analyzing images of faces.

Machine learning algorithms are also being used in medical fields, such as cancer detection and diagnosis. Algorithms can analyze patient data to identify patterns and diagnose diseases or recommend treatments.

In addition, machine learning algorithms are also being used in retail for product recommendations and personalized shopping experiences.

The automotive industry is another sector that is utilizing the power of machine learning. Autonomous vehicles use algorithms to sense their environment and safely navigate roads.

There are many different types of machine learning algorithms each designed to solve a certain type of problem.

So how do you know which Machine Learning Algorithm to use?

In this blog post, we’ll discuss about how to choose the right algorithm for your problem.

Let’s get started!

To determine which machine learning algorithm to choose, there are certain criteria to take into consideration.

#1: First, the type of problem to be solved must be identified.

First step is to understand the problem you want to solve and identify the type of problem it is.

For example:

  • Is it a classification problem such as classifying different types of fruit in a supermarket, or
  • Is it anomaly detection predicting unusual activity, or
  • Is it a regression problem to predict how much rain there was last month and figuring out how much rain to expect next month. or
  • Is it clustering such as grouping internet users based on their interests and then targeting advertising at that group.

#2: Examine the nature of data involved:

Once the type of problem has been identified, you should then examine nature of the data involved.

The appropriate machine learning algorithm to use will vary depending on the data:

  • Is the data linear or complex, or
  • Is the data structured or unstructured, or
  • Is the data numerical or categorical, or
  • Is the data sparse or dense, or
  • Is it sequential, or chained, or
  • Is the data labelled or unlabelled

A simple way to find this is to do an exploratory analysis of the data using tools such as pandas or sklearn.

#3: Select the machine learning algorithm

Once you have an understanding of the data, you can then narrow down your choices as to which machine learning algorithms are most suitable for your problem.

For example:

  • You can use decision tree — a great tool to use for classification and regression problems. It is easy to interpret and it works well when data has missing values or if there is noise in the dataset, Or
  • You can use a random forest, great at performing data mining on a very large dataset with many different variables.Or
  • If your dataset is small, then it might be worth trying a simple algorithm such as linear regression or k-nearest neighbours to see if the results are good enough for your needs.

#4: Determine the importance of Accuracy

Once you have selected your algorithm, then determine the importance of accuracy.

Accurate answers are sometimes, not necessary; even an approximation is sufficient, which may help us save time on training and processing.

For example, if we are forming a prediction model for predicting a disease in a patient, the accuracy of our predictions is of utmost importance.

On the other hand, when we are trying to recommend movies or songs to a user, accuracy is not as important as long as the recommendations are close enough to their interests.

These considerations will help you decide which algorithm to go for.

#5: Next determine the Speed:

In many cases, accuracy and speed are in direct conflict; an algorithm might be extremely accurate but very slow. You must therefore decide which is the most important factor for your problem and select the appropriate algorithm.

Is it Accuracy or time?

If time then choose simple algorithmn such as linear regression or KNN.

If accuracy is the main consideration then go for more complex algorithms like Random Forests or Support Vector Machines.

#6: Next look at the features:

The more features you have, the longer it takes to train and process your data.

Therefore, if you have a large number of features, it might be worth considering using an algorithm that can handle lots of data efficiently such as Gradient Boosting or Neural Networks.

On the other hand, if you have a small dataset with few features, then simpler algorithms may suffice .

While, there are many factors that might control the choose of an algorithm, they broadly come under either data-related or problem-related.

Data related include the type of data, size of dataset, behaviour, characteristics and the number of features.

Problem related include accuracy requirements and time-constraints.

The best algorithm to use will depend on a combination of these factors, as well as your own preferences and experience.


Choosing the right machine learning algorithm is a crucial step in creating successful models. It involves understanding the data and problem at hand, determining accuracy requirements and speed, considering the number of features, and deciding which algorithms are best suited for your needs.

By carefully evaluating these criteria, you can select an appropriate algorithm that will provide maximum performance for your problem. Once you have selected the right algorithm, you can then begin to implement and fine-tune it according to the needs of your project.

The best machine learning algorithms are those which provide an optimal balance between accuracy and speed, as well as take into consideration other factors such as data size, characteristics and number of features.



Director, AI & Data Science | MS Data Science | MBA |AI Content Creator | Mentor | Technology Executive | Innovation | Digital Transformation | Financial & Regulatory Compliance

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store