Sitemap

Algorithms of machine learning

6 min readJun 17, 2025

--

Grouping different types of algorithms that we come across in this learning cycle

1. Logistic Regression

  • Type: Classification
  • Description: Predicts the probability of a binary outcome using a logistic function.
  • Example: Predict whether an email is spam or not spam.

2. k-Nearest Neighbors (k-NN)

  • Type: Both (Classification & Regression)
  • Description: Predicts the output based on the majority class (classification) or average value (regression) of the nearest k neighbors.
  • Example:
  • Classification: Identify if a fruit is an apple, orange, or banana.
  • Regression: Predict house price based on nearby similar houses.

3. Decision Tree

  • Type: Both
  • Description: Splits the data into branches based on feature values until it reaches a decision (leaf node).
  • Example:
  • Classification: Predict whether a customer will churn.
  • Regression: Predict the price of a used car.

4. Random Forest

  • Type: Both
  • Description: An ensemble of decision trees that improves accuracy by averaging (regression) or voting (classification).
  • Example:
  • Classification: Detect sentiment in customer reviews.
  • Regression: Predict next week’s average temperature.

5. Support Vector Machine (SVM)

  • Type: Both
  • Description: Finds the best hyperplane that separates classes (SVM) or fits the data within a margin (SVR).
  • Example:
  • Classification: Identify if an image is a cat or a dog.
  • Regression: Predict future stock prices.

6. Naive Bayes

  • Type: Classification
  • Description: A probabilistic model based on Bayes’ theorem assuming feature independence.
  • Example: Classify a document as spam or not spam.

7. Multilayer Perceptron (MLP / Neural Network)

  • Type: Both
  • Description: A deep learning model with layers of neurons; uses softmax for classification and linear output for regression.
  • Example:
  • Classification: Handwritten digit recognition (0–9).
  • Regression: Predict house prices.

8. Linear Discriminant Analysis (LDA)

  • Type: Classification
  • Description: Projects data to maximize separation between multiple classes.
  • Example: Classify patients into disease risk categories.

9. k-Means Clustering

  • Type: Unsupervised Clustering
  • Description: Groups data into k clusters based on feature similarity.
  • Example: Segment customers into groups based on shopping habits.

10. Linear Regression

  • Type: Regression
  • Description: Fits a straight line through data to predict continuous values.
  • Example: Predict the selling price of a house based on its size.

11. Ridge Regression

  • Type: Regression
  • Description: Linear regression with L2 regularization to reduce overfitting.
  • Example: Predict house price while keeping model coefficients small.

12. Lasso Regression

  • Type: Regression
  • Description: Linear regression with L1 regularization that can shrink some coefficients to zero (feature selection).
  • Example: Predict salary based on many job-related features, automatically ignoring less important ones.

13. Support Vector Regression (SVR)

  • Type: Regression
  • Description: Uses the same principles as SVM but fits a function within a margin to predict continuous values.
  • Example: Predict next month’s stock prices based on recent trends.

🔶 Unsupervised Learning Algorithms

These algorithms do not use labeled data. The model finds patterns, groupings, or structures in the data on its own.

1. k-Means Clustering

  • Type: Clustering (Unsupervised)
  • Description: Partitions data into k clusters based on feature similarity; each point belongs to the nearest cluster center.
  • Example: Group retail customers based on purchase behavior into segments like “bargain hunters,” “loyal customers,” etc.

2. Hierarchical Clustering

  • Type: Clustering (Unsupervised)
  • Description: Builds a hierarchy (tree-like structure) of clusters by either merging or splitting groups.
  • Example: Organize animals by genetic similarity or group documents by topic.

3. DBSCAN (Density-Based Spatial Clustering)

  • Type: Clustering (Unsupervised)
  • Description: Finds clusters of arbitrary shape based on density. It identifies noise and outliers.
  • Example: Detect geographic clusters of earthquakes or unusual behavior in a network.

4. Principal Component Analysis (PCA)

  • Type: Dimensionality Reduction (Unsupervised)
  • Description: Reduces high-dimensional data to fewer components while retaining most variance.
  • Example: Compress image data or simplify genetic data before analysis.

5. Autoencoders

  • Type: Dimensionality Reduction / Feature Learning (Unsupervised)
  • Description: Neural networks that learn compressed representations (encoding) and attempt to reconstruct the input.
  • Example: Reduce image noise or extract compressed features for image search.

🔷 Ensemble Learning Algorithms

These combine multiple models to improve prediction performance, reduce variance, and avoid overfitting.

6. Random Forest

  • Type: Both Classification and Regression
  • Description: Combines multiple decision trees trained on different subsets of the data and features.
  • Example:
  • Classification: Predict if a review is positive or negative.
  • Regression: Predict energy consumption of a building.

7. Gradient Boosting Machines (GBM)

  • Type: Both
  • Description: Builds models sequentially where each new model corrects the errors of the previous ones.
  • Example: Predict likelihood of loan default based on customer history.

8. XGBoost / LightGBM / CatBoost

  • Type: Both
  • Description: Highly optimized versions of gradient boosting with better speed and regularization.
  • Example: Predict click-through rate on online ads or customer churn.

9. Voting Classifier / Averaging Regressor

  • Type: Both
  • Description: Combines predictions from multiple models by voting (classification) or averaging (regression).
  • Example: Use SVM, k-NN, and Random Forest together to classify a medical diagnosis more accurately.

🔵 Deep Learning Architectures

Deep learning is a subset of machine learning that uses neural networks with many layers.

Get Naveen’s stories in your inbox

Join Medium for free to get updates from this writer.

10. Convolutional Neural Networks (CNNs)

  • Type: Classification / Detection (Supervised)
  • Description: Specialized for processing grid-like data such as images. Extract spatial features using filters.
  • Example: Classify handwritten digits (MNIST) or detect objects in images (cats, cars, etc.).

11. Recurrent Neural Networks (RNNs) / LSTMs

  • Type: Sequence Modeling (Supervised)
  • Description: Designed for sequential data. LSTMs solve long-term dependency issues.
  • Example: Predict next word in a sentence or forecast time-series data like weather or sales.

12. Transformers

  • Type: Sequence Modeling (Supervised, Self-Supervised)
  • Description: Use attention mechanisms to model long-range dependencies in sequences, very efficient for NLP.
  • Example: Language translation, text summarization, ChatGPT itself!

13. GANs (Generative Adversarial Networks)

  • Type: Generative (Unsupervised/Self-Supervised)
  • Description: Two networks (Generator + Discriminator) compete to produce realistic data.
  • Example: Generate synthetic faces, art, or deepfake videos.

14. Self-Organizing Maps (SOMs)

  • Type: Clustering / Dimensionality Reduction (Unsupervised)
  • Description: A neural network that maps high-dimensional input to a lower-dimensional space for visualization.
  • Example: Visualize customer similarity or image features.

✅ Summary

  • Unsupervised: No labels → find patterns, clusters, or reduce dimensions.
  • Ensemble: Combine multiple models → better accuracy, robustness.
  • Deep Learning: Neural networks → handle images, text, sequences, generation tasks.

Now, let’s walk through one scenario and see how each algorithm would apply.

🎯 Scenario: You work at a healthcare startup building a system to help hospitals and doctors predict and manage patient health outcomes.

🔵 Classification Algorithms

1. Logistic Regression

  • Use: Predict if a patient will develop diabetes (yes/no).
  • Why: Simple, fast, good baseline for binary outcomes.

2. k-NN

  • Use: Classify a patient’s condition based on similar historical patients (diabetic or not).
  • Why: Easy to implement, works well with small datasets.

3. Decision Tree

  • Use: Decide if a patient needs urgent care based on symptoms.
  • Why: Interpretable and follows human-like reasoning.

4. Random Forest

  • Use: Predict disease type using multiple patient features.
  • Why: Reduces overfitting, improves accuracy.

5. SVM

  • Use: Classify patient MRI images as normal vs abnormal.
  • Why: Effective with high-dimensional medical imaging data.

6. Naive Bayes

  • Use: Classify whether a patient report is a high-risk or low-risk alert.
  • Why: Fast and effective with text-based data.

7. MLP (Neural Network)

  • Use: Classify X-ray scans into disease categories.
  • Why: Learns complex non-linear patterns.

8. LDA

  • Use: Reduce features and classify patient risk levels.
  • Why: Good for dimensionality reduction + classification.

🟢 Regression Algorithms

9. Linear Regression

  • Use: Predict the cost of a patient’s treatment.
  • Why: Simple, interpretable baseline.

10. Ridge Regression

  • Use: Predict treatment cost while preventing overfitting.
  • Why: Handles multicollinearity well.

11. Lasso Regression

  • Use: Predict cost and eliminate irrelevant patient features.
  • Why: Performs feature selection.

12. SVR (Support Vector Regression)

  • Use: Predict the length of hospital stay.
  • Why: Handles non-linear relationships with kernel tricks.

13. k-NN Regression

  • Use: Predict a patient’s recovery time based on similar cases.
  • Why: Good when similar examples produce similar outcomes.

14. Decision Tree Regressor

  • Use: Predict the time until next doctor visit.
  • Why: Handles non-linear and interaction terms.

15. Random Forest Regressor

  • Use: Predict future patient expenses.
  • Why: Robust and handles large feature sets.

16. MLP for Regression

  • Use: Predict future blood pressure levels.
  • Why: Can capture complex time trends if fed past data.

🟣 Unsupervised Learning

17. k-Means

  • Use: Segment patients by lifestyle patterns.
  • Why: Simple and effective for grouping.

18. Hierarchical Clustering

  • Use: Understand relationships between genetic conditions.
  • Why: Builds a visual hierarchy of similarity.

19. DBSCAN

  • Use: Detect unusual patient behavior (anomalies).
  • Why: Finds outliers, doesn’t need pre-defined clusters.

20. PCA

  • Use: Reduce dimensionality of lab test data.
  • Why: Helps visualize and simplify data.

21. Autoencoders

  • Use: Compress patient data for anomaly detection.
  • Why: Learns efficient representations.

22. Self-Organizing Maps (SOMs)

  • Use: Visualize patient health profiles in 2D.
  • Why: Great for interpreting high-dimensional data.

🔶 Deep Learning Architectures

23. CNN (Convolutional Neural Network)

  • Use: Detect pneumonia from chest X-rays.
  • Why: Best for spatial image data.

24. RNN / LSTM

  • Use: Predict patient heart rate over time.
  • Why: Designed for sequential, time-series data.

25. Transformers

  • Use: Analyze patient-doctor chat transcripts.
  • Why: Handles long text sequences efficiently.

26. GANs

  • Use: Generate synthetic medical images for training.
  • Why: Useful for data augmentation.

--

--