Tuesday , December 1 2026
Supervised, unsupervised, semi-supervised, self-supervised and reinforcement learning explained with examples, algorithms and a scikit-learn comparison.

Types of Machine Learning: Supervised, Unsupervised and Reinforcement

Updated: 29 November 2026Level: BeginnerReading time: about 8 minutesConcepts · scikit-learn

Machine learning problems fall into a few types depending on what data you have and what you want to achieve. Choosing the right type is the first decision in any project.

What You Will Learn

  • Supervised learning: regression and classification
  • Unsupervised learning: clustering, dimensionality reduction, association
  • Semi-supervised and self-supervised learning
  • Reinforcement learning
  • How to choose

Supervised Learning

You have inputs and correct answers (labels). The model learns the mapping.

Task Output Algorithms on this site
Regression A number (price, temperature) Linear, Polynomial, Random Forest, SVR
Classification A category (spam / not spam) Logistic, KNN, Naive Bayes, SVM, Decision Tree, XGBoost

Unsupervised Learning

Only inputs, no labels. The model discovers structure.

Task Goal Algorithms
Clustering Group similar items K-Means, Hierarchical, DBSCAN
Dimensionality reduction Fewer features, same information PCA, LDA (LDA is supervised), t-SNE
Association rules Items bought together Apriori
Anomaly detection Find unusual points Isolation Forest – see outliers

In Between

Type Idea Example
Semi-supervised A few labels + many unlabelled examples Labelling 1% of medical images
Self-supervised Create labels from the data itself LLMs predicting the next word – see LLM fundamentals

Reinforcement Learning

An agent takes actions in an environment and receives rewards. It learns a policy that maximises total reward – used in games (AlphaGo), robotics, recommendation and in tuning LLMs with human feedback (RLHF).

Same Data, Two Types

Example
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.cluster import KMeans

X, y = load_iris(return_X_y=True)
clf = LogisticRegression(max_iter=1000).fit(X, y)          # supervised: uses y
km = KMeans(n_clusters=3, n_init=10, random_state=0).fit(X)   # unsupervised: ignores y
print(clf.predict(X[:3]), km.labels_[:3])
Output
[0 0 0] [1 1 1]

Explanation: The classifier learns the real species names from labels. K-Means groups the same flowers without labels; its cluster numbers are arbitrary (setosa became cluster 1, not 0) and must be interpreted afterwards.

How to Choose

You have… You want… Type
Labels Predict a number Supervised regression
Labels Predict a category Supervised classification
No labels Find groups or structure Unsupervised
A simulator or live feedback Learn actions over time Reinforcement

Series

ML fundamentals series: What is ML · Types of ML · Train/Test Split · Overfitting & Bias-Variance · Regularization · Confusion Matrix · ROC & AUC · Cross-Validation · Ensembles · DBSCAN

Interview Questions

Q: Supervised vs unsupervised learning?
Supervised uses labelled data to predict a target; unsupervised finds structure in unlabelled data.

Q: Is predicting the next word supervised?
It is self-supervised: the labels (next words) come from the text itself.

Q: Regression vs classification?
Regression predicts continuous values; classification predicts discrete classes.

Practice Exercises

  1. Classify these tasks by type: credit scoring, grouping news articles, a robot learning to walk, predicting rainfall in mm.
  2. Run the iris example and compare KMeans labels with the true species using pd.crosstab.

Summary

Supervised learning predicts labelled targets (regression or classification), unsupervised learning finds structure, reinforcement learning learns from rewards, and semi/self-supervised learning sit in between.

Next: Train-Test Split

About Machine Learning

Check Also

Confusion Matrix in Machine Learning (with Python Example)

Confusion matrix explained with a tested scikit-learn example: TP, TN, FP, FN, classification report, metrics formulas and the effect of thresholds.