Damitha.
Lab Notebook
Machine Learning

Machine Learning 101: Supervised vs Unsupervised Learning

The most fundamental split in machine learning, explained with examples from genomic data.

7 September 20263 min read
machine-learningbasics

Almost every ML method falls into one of two camps, depending on whether the training data comes with "answers" attached.

Supervisedlabelled: "benign"labelled: "pathogenic"labelled: "benign"learns to predict the labelUnsupervisedfinds structure with no labels

Supervised learning

You have input data and the correct answer for each example, and the model learns the mapping between them. Two flavours:

  • Classification - predicting a category. e.g. is this variant benign or pathogenic? Is this blood smear image showing signs of thalassemia or not?
  • Regression - predicting a number. e.g. predicting a continuous risk score from lab values.

Common algorithms: logistic regression, random forests, gradient-boosted trees (XGBoost/LightGBM), and neural networks.

Unsupervised learning

There's no label - the goal is to find structure in the data itself.

  • Clustering - grouping similar samples together (e.g. clustering patients by expression profile to discover disease subtypes you didn't know to look for).
  • Dimensionality reduction - compressing thousands of features (e.g. gene expression values) down to a handful that capture most of the variation, often for visualisation (PCA, UMAP, t-SNE are the common tools here).

Where they meet in practice

Real projects often use both. A typical pattern in genomics: use unsupervised dimensionality reduction (PCA) to explore and QC a dataset first, spot batch effects or outliers, then train a supervised classifier on the cleaned data to make the actual prediction.

A note on evaluation

For clinical or diagnostic classifiers specifically, accuracy alone is a misleading metric - a model that always predicts "healthy" can score 95% accuracy on a rare-disease dataset while being useless. Sensitivity (catching true positives), specificity (avoiding false alarms), and AUC-ROC are the metrics that actually matter for this kind of work.

A Gentle Introduction to Machine Learning - StatQuest

Further reading