# Machine Learning Cheat Sheet

In this cheat sheet, you'll have a guide around the top machine learning algorithms, their advantages and disadvantages, and use-cases.

When working with machine learning, it's easy to try them all out without understanding what each model does, and when to use them. In this cheat sheet, you'll find a handy guide describing the most widely used machine learning models, their advantages, disadvantages, and some key use-cases.

For a printable version of this cheat sheet, make sure to press on the image above

## Supervised Learning

Supervised learning models are models that map inputs to outputs, and attempt to extrapolate patterns learned in past data on unseen data. Supervised learning models can be either regression models, where we try to predict a continuous variable, like stock prices—or classification models, where we try to predict a binary or multi-class variable, like whether a customer will churn or not. In the section below, we'll explain two popular types of supervised learning models: linear models, and tree-based models.

### Linear Models

In a nutshell, linear models create a best-fit line to predict unseen data. Linear models imply that outputs are a linear combination of features. In this section, we'll specify commonly used linear models in machine learning, their advantages, and disadvantages.

 Algorithm Description Applications Advantages Disadvantages Linear Regression A simple algorithm that models a linear relationship between inputs and a continuous numerical output variable Stock Price Prediction Predicting housing prices Predicting customer lifetime value Explainable method Interpretable results by its output coefficient Faster to train than other machine learning models Assumes linearity between inputs and output Sensitive to outliers Can underfit with small, high-dimensional data Logistic Regression A simple algorithm that models a linear relationship between inputs and a categorical output (1 or 0) Predicting credit risk score Customer churn prediction Interpretable and explainable Less prone to overfitting when using regularization Applicable for multi-class predictions Assumes linearity between inputs and outputs Can overfit with small, high-dimensional data Ridge Regression Part of the regression family — it penalizes features that have low predictive outcomes by shrinking their coefficients closer to zero. Can be used for classification or regression Predictive maintenance for automobiles Sales revenue prediction Less prone to overfitting Best suited where data suffer from multicollinearity Explainable & interpretable All the predictors are kept in the final model Doesn't perform feature selection Lasso Regression Part of the regression family — it penalizes features that have low predictive outcomes by shrinking their coefficients to zero. Can be used for classification or regression Predicting housing prices Predicting clinical outcomes based on health data Less prone to overfitting Can handle high-dimensional data No need for feature selection Can lead to poor interpretability as it can keep highly correlated variables

### Tree-based models

In a nutshell, tree-based models use a series of "if-then" rules to predict from decision trees. In this section, we'll specify commonly used linear models in machine learning, their advantages, and disadvantages.

 Algorithm Description Applications Advantages Disadvantages Decision Tree Decision Tree models make decision rules on the features to produce predictions. It can be used for classification or regression Customer churn prediction Credit score modeling Disease prediction Explainable and interpretable Can handle missing values Prone to overfitting Sensitive to outliers Random Forests An ensemble learning method that combines the output of multiple decision trees Credit score modeling Predicting housing prices Reduces overfitting Higher accuracy compared to other models Training complexity can be high Not very interpretable Gradient Boosting Regression Gradient Boosting Regression employs boosting to make predictive models from an ensemble of weak predictive learners Predicting car emissions Predicting ride-hailing fare amount Better accuracy compared to other regression models It can handle multicollinearityIt can handle non-linear relationships Sensitive to outliers and can therefore cause overfitting Computationally expensive and has high complexity XGBoost Gradient Boosting algorithm that is efficient & flexible. Can be used for both classification and regression tasks Churn prediction Claims processing in insurance Provides accurate results Captures non-linear relationships Hyperparameter tuning can be complex Does not perform well on sparse datasets LightGBM Regressor A gradient boosting framework that is designed to be more efficient than other implementations Predicting flight time for airlines Predicting cholesterol levels based on health data Can handle large amounts of data Computational efficient & fast training speed Low memory usage Can overfit due to leaf-wise splitting and high sensitivity Hyperparameter tuning can be complex

## Unsupervised Learning

Unsupervised learning is about discovering general patterns in data. The most popular example is clustering or segmenting customers and users. This type of segmentation is generalizable and can be applied broadly, such as to documents, companies, and genes. Unsupervised learning consists of clustering models, that learn how to group similar data points together, or association algorithms, that group different data points based on pre-defined rules.

### Clustering models

 Algorithm Description Applications Advantages Disadvantages K-Means K-Means is the most widely used clustering approach—it determines K clusters based on euclidean distances Customer segmentation Recommendation systems Scales to large datasets Simple to implement and interpret Results in tight clusters Requires the expected number of clusters from the beginning Has troubles with varying cluster sizes and densities Hierarchical Clustering A "bottom-up" approach where each data point is treated as its own cluster—and then the closest two clusters are merged together iteratively Fraud detection Document clustering based on similarity There is no need to specify the number of clusters The resulting dendrogram is informative Doesn’t always result in the best clustering Not suitable for large datasets due to high complexity Gaussian Mixture Models A probabilistic model for modeling normally distributed clusters within a dataset Customer segmentation Recommendation systems Computes a probability for an observation belonging to a cluster Can identify overlapping clusters More accurate results compared to K-means Requires complex tuning Requires setting the number of expected mixture components or clusters

### Association

 Algorithm Description Applications Advantages Disadvantages Apriori Algorithm Rule based approach that identifies the most frequent itemset in a given dataset where prior knowledge of frequent itemset properties is used Product placements Recommendation engines Promotion optimization Results are intuitive and Interpretable Exhaustive approach as it finds all rules based on the confidence and support Generates many uninteresting itemsets Computationally and memory intensive.Results in many overlapping item sets

Have this Cheat Sheet at your fingertips