Skip to content

Independent AI & deep-tech news

Data Science

List Of Common Machine Learning Algorithms

List Of Common Machine Learning Algorithms
List Of Common Machine Learning Algorithms
On this page
  1. Key takeaways
  2. Why is there no single best algorithm?
  3. How do the common algorithms compare?
  4. What is linear regression?
  5. What is logistic regression?
  6. When should you use linear discriminant analysis?
  7. How do decision trees and Naive Bayes work?
  8. How do support vector machines and nearest neighbors work?
  9. What are ensemble methods like random forest and AdaBoost?
  10. Frequently asked questions
  11. Conclusion

The most common machine learning algorithms for predictive modeling are linear regression, logistic regression, linear discriminant analysis, decision trees, Naive Bayes, support vector machines, k-nearest neighbors, learning vector quantization, random forest and AdaBoost. No single one works best for every problem, so the right choice depends on your data and your goal.

Key takeaways

  • The “No Free Lunch” theorem says no algorithm performs best on every problem.
  • Try several algorithms and compare them on a held-out test set.
  • Linear and logistic regression are good, quick first choices for regression and binary classification.
  • Ensemble methods such as random forest and AdaBoost combine many models for stronger predictions.

Why is there no single best algorithm?

The “No Free Lunch” theorem states that no machine learning algorithm works best for every problem. It applies mainly to supervised learning, which is predictive modeling.

For example, a neural network is not always better than a decision tree, or the other way around. The structure and size of the dataset play a large part.

For that reason, it is wise to test several algorithms and use a hold-out test set to compare their performance and pick the winner. The algorithms must also suit the type of problem. If you want to clean a room you might use a broom, a vacuum cleaner or a mop, but not a shovel.

How do the common algorithms compare?

Algorithm Typical use Key point
Linear regression Predicting numeric values Fast, simple, a good first algorithm to try
Logistic regression Binary classification Fast to understand and effective on two-class problems
Linear discriminant analysis Classification with more than two classes Assumes a bell-curve distribution
Decision trees (CART) Classification and regression Fast to train and predict, little data preparation
Naive Bayes Classification Assumes input variables are unrelated, yet works well
Support vector machines Classification Finds the boundary with the widest margin
K-nearest neighbors Classification and regression Stores the whole training set
Learning vector quantization Classification Reduces the memory needs of k-nearest neighbors
Random forest (bagging) Classification and regression Ensemble of many trees
AdaBoost (boosting) Binary classification Builds a strong classifier from weak ones

What is linear regression?

Linear regression is one of the best-known and best-understood algorithms in statistics and machine learning. It has existed for more than 200 years and has been studied extensively.

The model can be learned from data in several ways, including ordinary least squares and gradient descent optimization. Useful rules of thumb are to remove variables that are highly correlated with each other and to remove noise from the data where possible.

What is logistic regression?

Logistic regression is the standard technique for binary classification, where there are two class values. Like linear regression, it learns a coefficient for each input variable. Unlike linear regression, the prediction passes through a nonlinear logistic function.

It also works best when you remove irrelevant features and features that are highly correlated with one another. It is quick to learn and effective on binary problems.

When should you use linear discriminant analysis?

Logistic regression is normally limited to two-class problems. When there are more than two classes, linear discriminant analysis (LDA) is the usual linear classification technique.

The model uses statistical properties of the data for each class. For a single input variable, these are the mean of each class and the variance calculated across all classes. Predictions come from computing a discriminant value for each class and choosing the class with the largest value.

LDA assumes the data follows a Gaussian (bell-curve) distribution, so removing outliers beforehand is sensible.

How do decision trees and Naive Bayes work?

Classification and regression trees

Decision trees are a powerful algorithm for predictive modeling. They are quick to learn and make predictions quickly, they are often accurate on a wide range of problems, and they do not require special preparation of the data.

Naive Bayes

Naive Bayes is a simple but surprisingly powerful algorithm. The model holds two kinds of probabilities that can be computed directly from the training data: the probability of each class, and the conditional probability of each input value given each class.

Predictions for new data use Bayes’ theorem. For real-valued data, a Gaussian distribution is commonly assumed. The method is called naive because it assumes every input variable is independent, which is rarely true for real data, yet it works well on many complex problems.

How do support vector machines and nearest neighbors work?

Support vector machines

A hyperplane is a line that splits the input variable space. In a support vector machine (SVM), the hyperplane is chosen to separate the points by class as well as possible. In two dimensions this can be pictured as a line.

The distance between the hyperplane and the closest data points is the margin, and the best hyperplane is the one with the largest margin. Only those closest points, called support vectors, define the hyperplane. An optimization algorithm finds the coefficients that maximize the margin. SVM is a strong out-of-the-box classifier worth trying on most datasets.

K-nearest neighbors

The model for k-nearest neighbors (KNN) is the whole training dataset. To predict for a new point, the algorithm finds the K most similar training examples and summarizes their outcomes. For regression this is typically the mean, and for classification the most common class.

The main task is deciding how to measure similarity. If all features are on the same scale, Euclidean distance is a simple choice.

Learning vector quantization

KNN requires storing the entire training dataset. Learning vector quantization (LVQ) is a neural network algorithm that lets you choose how many examples to keep and learns what those examples should look like. If KNN gives good results on your data, LVQ can reduce the memory it needs.

What are ensemble methods like random forest and AdaBoost?

Random forest is a popular and powerful algorithm. It is a type of ensemble method called bagging, short for bootstrap aggregation. The bootstrap is a statistical technique for estimating a quantity, such as a mean, by taking many samples of the data and averaging the results.

Boosting builds a strong classifier from several weak ones. A first model is trained, then the next model tries to correct the errors of the one before it. Models are added until the training set is predicted well or a maximum number of models is reached.

AdaBoost was the first successful boosting algorithm for binary classification and is a good starting point for understanding boosting. Modern methods such as stochastic gradient boosting machines build on it.

Frequently asked questions

Which machine learning algorithm should a beginner start with?

Linear regression for numeric prediction and logistic regression for two-class problems are common starting points because they are fast and easy to understand.

How do I choose between algorithms?

The answer depends on the quality, size and nature of the data, the computing time available, how urgent the task is, and what you want to do with the data. Testing several candidates on a hold-out set is the practical approach.

What does Naive Bayes assume?

It assumes that all input variables are independent of each other. The assumption is rarely true, but the method still works well in many cases.

What is the difference between bagging and boosting?

Bagging averages many models trained on samples of the data, as in random forest. Boosting adds models one after another, each correcting the previous model’s mistakes, as in AdaBoost.

Conclusion

Choosing a machine learning algorithm means weighing the data, the available computing resources, the urgency of the task and the goal. Because no algorithm wins everywhere, trying several and measuring them on held-out data is the reliable way to decide.

Written by

Tarun Khanna

584 articles on DeepTechBytes