Machine Learning Algorithms Cheat Sheet
8/3/2026, 5:38:25 PM · updated 8/3/2026, 6:04:39 PM · Source
A comprehensive reference covering the four main categories of machine learning algorithms with descriptions, purposes, and real-world use cases for each commonly used method.
Machine learning algorithms are sets of rules that help computer systems learn and make decisions without being explicitly programmed for every task. They analyze data to identify patterns and hidden relationships, then use that information to make predictions about new data and solve problems. Machine learning algorithms can recognize images, forecast future outcomes from historical data, and group similar items together. They can also improve over time as they learn from additional data.
Machine learning algorithms can be divided into four main types:
- Supervised learning
- Unsupervised learning
- Reinforcement learning
- Semi-supervised learning
1. Supervised Learning Algorithms
Supervised learning involves training a model on a labeled dataset, where each training example is paired with its correct output label. The goal is to learn from these input-output pairs so the model can predict labels or values for new, unseen data.
Supervised learning includes two major types of tasks:
- Regression: Predicts continuous numerical values.
- Classification: Predicts categories or class labels.
| Algorithm | Description | Purpose | Best Use Cases |
|---|---|---|---|
| Linear Regression | Predicts a continuous output based on input features. | Predict continuous numerical outcomes. | House-price prediction; sales or revenue forecasting. |
| Logistic Regression | Predicts the probability that an input belongs to a particular class. | Classify data, commonly between two classes. | Spam detection; customer-purchase prediction. |
| Decision Trees | Splits data into subsets based on input features. | Simplify and explain decision-making processes. | Customer segmentation; disease diagnosis. |
| Random Forest | Combines multiple decision trees through ensemble learning. | Improve predictive accuracy and reduce overfitting. | Credit scoring; stock-price prediction. |
| Support Vector Machines (SVM) | Finds the hyperplane that best separates classes. | Maximize the margin between classes. | Image classification; handwriting recognition. |
| k-Nearest Neighbors (k-NN) | Makes predictions based on proximity to known data points. | Classify or predict using nearby observations. | Recommender systems; intrusion detection. |
| Naive Bayes | Classifies data using probabilistic relationships and an assumption of feature independence. | Perform efficient probabilistic classification. | Spam filtering; sentiment analysis. |
| Ensemble Learning | Combines predictions from multiple models, such as decision trees. | Improve model accuracy and robustness. | Fraud detection using multiple models; large-scale prediction tasks. |
2. Unsupervised Learning Algorithms
Unsupervised learning works with unlabeled data. Its goal is to discover hidden patterns or structures within the input data. Common unsupervised tasks include clustering, dimensionality reduction, visualization, and association-rule mining.
| Algorithm | Description | Purpose | Best Use Cases |
|---|---|---|---|
| k-Means Clustering | Partitions data into k clusters based on the nearest mean. | Group similar data points together. | Market segmentation; document clustering. |
| Hierarchical Clustering | Builds a hierarchy of clusters using agglomerative or divisive methods. | Create nested groups of related observations. | Gene-data analysis; social-network analysis. |
| Principal Component Analysis (PCA) | Transforms data into a new coordinate system with fewer dimensions. | Reduce dimensionality while retaining important variation. | Image compression; feature extraction. |
| t-Distributed Stochastic Neighbor Embedding (t-SNE) | Uses nonlinear dimensionality reduction to represent high-dimensional data in fewer dimensions. | Visualize high-dimensional data. | Cluster visualization; exploratory pattern analysis. |
| Apriori Algorithm | Identifies frequent itemsets and derives association rules. | Discover relationships among items in large datasets. | Market-basket analysis; recommender systems. |
3. Reinforcement Learning Algorithms
Reinforcement learning (RL) trains an agent to make a sequence of decisions by rewarding desirable actions and penalizing undesirable ones. The agent learns a strategy for maximizing its cumulative reward through interaction with an environment.
| Algorithm | Description | Purpose | Best Use Cases |
|---|---|---|---|
| Q-Learning | Learns the value of taking an action in a particular state, often using a Q-table. | Learn optimal actions within an environment. | Game playing; robotics. |
| Deep Q-Networks (DQN) | Combines Q-learning with deep neural networks. | Handle complex or high-dimensional state spaces. | Autonomous driving research; complex strategy games. |
| Actor-Critic Methods | Combine policy-based and value-based approaches. | Balance action selection and value estimation while supporting exploration. | Real-time strategy games; dynamic resource allocation. |
4. Semi-Supervised Learning Algorithms
Semi-supervised learning is a hybrid approach that uses a small amount of labeled data together with a larger amount of unlabeled data. The labeled examples guide the learning process, while the unlabeled examples help the model identify broader patterns in the dataset.
This approach is useful when labeling all available data would be costly, slow, or impractical, or when a model must adapt quickly with limited labeled examples.
For example, data for a rare disease may be limited and expensive to label. A semi-supervised model can learn from a large collection of unlabeled medical data while using a much smaller set of labeled cases for guidance.
Common semi-supervised learning algorithms include:
- Self-training: A model trained on labeled data assigns pseudo-labels to confident unlabeled examples and retrains using the expanded dataset.
- Co-training: Multiple models or feature views teach one another by adding confidently predicted unlabeled examples to the training data.
Quick Selection Guide
| Data and Goal | Learning Type | Example |
|---|---|---|
| Labeled data; predict a numerical value | Supervised learning—regression | Forecast revenue. |
| Labeled data; predict a category | Supervised learning—classification | Detect spam. |
| Unlabeled data; discover groups or patterns | Unsupervised learning | Segment customers. |
| Sequential decisions with rewards and penalties | Reinforcement learning | Train a game-playing agent. |
| Small labeled dataset plus a large unlabeled dataset | Semi-supervised learning | Classify medical images with limited expert labels. |
Learning map
Learning Map: Machine Learning Algorithms
Stage 1 — Foundations
- What is machine learning and how does it differ from traditional programming?
- Supervised vs. unsupervised vs. reinforcement vs. semi-supervised learning (the big picture)
Stage 2 — Supervised Learning
- Regression algorithms (linear regression, polynomial regression)
- Classification algorithms (logistic regression, decision trees, SVM, k-NN, Naive Bayes)
- Ensemble methods (random forest, boosting)
Stage 3 — Unsupervised Learning
- Clustering (k-means, hierarchical clustering)
- Dimensionality reduction (PCA, t-SNE)
- Association rules (Apriori)
Stage 4 — Reinforcement & Semi-Supervised Learning
- Core concepts of reinforcement learning and how agents learn through rewards
- Hybrid approach: leveraging labeled + unlabeled data in semi-supervised settings
Stage 5 — Practice & Comparison
- Mapping problem types to the right algorithm family
- Hands-on implementation with scikit-learn
Get hands-on — step by step
- Install Python (3.9+) and a code environment such as Jupyter Notebook or VS Code.
- Install scikit-learn: run
pip install scikit-learn jupyter numpy pandas matplotlibin your terminal. - Import the libraries: open a notebook and add
import numpy as np, import pandas as pd, import matplotlib.pyplot as plt, from sklearn.datasets import make_classification, make_regressionat the top. - Supervised — Classification: generate sample data via
X, y = make_classification(n_samples=300, n_features=4), fit a Decision Tree withfrom sklearn.tree import DecisionTreeClassifier; clf = DecisionTreeClassifier(); clf.fit(X, y), and evaluate withclf.score(X, y). - Supervised — Regression: generate regression data via
X_r, y_r = make_regression(n_samples=300, n_features=2), fit a Linear Regression model, and plot predictions on a scatter chart. - Unsupervised — Clustering: use
from sklearn.cluster import KMeansfollowed byKMeans(n_clusters=3).fit_predict(X)to group unlabeled data. - Unsupervised — Dimensionality Reduction: apply PCA with
from sklearn.decomposition import PCA; pca = PCA(n_components=2); X_pca = pca.fit_transform(X_r)and plot the reduced data points. - Compare algorithm outputs side-by-side in a table or bar chart to see which methods produce stronger accuracy or clearer clusters for your sample data.
Top 3 sources
- 1Scikit-learn User Guide
The definitive Python library reference for practically implementing every major ML algorithm covered in this sheet, with clear API examples and comparison charts.
https://scikit-learn.org/stable/user_guide.html
- 2Andrew Ng's Machine Learning Specialization (Coursera)
A widely used, structured course that walks through the theory and intuition behind each algorithm family with hands-on programming exercises.
https://www.coursera.org/specializations/machine-learning-introduction
- 3Google Machine Learning Crash Course
A free, self-paced course covering all four ML categories with quick-reference visuals, interactive quizzes, and TensorFlow-based examples.
https://developers.google.com/machine-learning/crash-course
Links are AI-suggested — worth a quick sanity check before diving in.