Data and modeling

Machine learning for unlabeled data

Machine learning can find structure in data with no labels. Clustering groups similar customers or records, dimensionality reduction maps high-dimensional data into a view you can inspect, and autoencoders learn what normal data looks like so unusual records stand out.

Where to start

Learn distances, scaling and PCA first, because they decide what similar means for every clustering method. Then try k-means and HDBSCAN, and check groupings against held-back labels or a downstream task rather than how neat a plot looks.

How machine learning is used on unlabelled data

Mapping high-dimensional data

Dimensionality reduction turns thousands of measurements per record into a two-dimensional map in which similar records sit together. Scientists and analysts use these maps to spot groups, gradients and odd samples before any labelling.

Real example: UMAP for single-cell data (Becht et al., Nature Biotechnology, 2019). The authors applied UMAP to mass cytometry and single-cell RNA sequencing datasets and compared it with five other dimensionality-reduction tools.

Finding topics in documents

Topic models describe a collection of documents as mixtures of themes, each a distribution over words, with no labelled examples. They are used to explore archives, research literature and customer feedback.

Real example: Latent Dirichlet Allocation (Blei, Ng and Jordan, JMLR 2003). The paper introduced LDA, a generative probabilistic model for collections of discrete data such as text corpora.

Learning representations without labels

Self-supervised learning creates its own training task from raw data, such as matching two augmented views of the same image. The learned representation is then fine-tuned with only a small labelled set.

Real example: SimCLR (Chen et al., 2020). SimCLR is a simple framework for contrastive self-supervised learning of visual representations, without specialised architectures or a memory bank.

Creating labels cheaply

When hand labelling is the bottleneck, teams write rules that label data noisily and use a model to combine and denoise them. The result trains an ordinary classifier.

Real example: Snorkel (Ratner et al., 2017). Snorkel lets users train models without hand labelling by writing labelling functions, whose noisy outputs it denoises without access to ground truth.

Can you learn machine learning for unlabelled data?

Yes. Unsupervised learning uses the same Python tools as supervised learning, and the core methods, clustering and dimensionality reduction, are taught early. You need some linear algebra for PCA and a clear way to judge results that have no labels.

  1. Python and data tools. Load, scale and plot data in NumPy, pandas and Matplotlib, since unsupervised results are mostly judged by inspection. Taught in the Data Tools track of Foundations of AI
  2. Vectors and matrices. Learn distances, dot products and matrix decompositions, which underlie clustering, PCA and embeddings. Taught in the Maths track of Foundations of AI
  3. Clustering and dimensionality reduction. Apply k-means, hierarchical clustering, PCA and UMAP, and check whether groups are stable across runs and samples. Taught in the Machine Learning track of Foundations of AI
  4. Representation learning. Train autoencoders and use self-supervised embeddings, then fine-tune on a small labelled set. Covered by the Deep Learning course (coming next)

Moving into unsupervised and self-supervised learning

If you already work in the field

Researchers and analysts with large unlabelled datasets, such as survey text, sensor logs or biological measurements, already know which groupings would be meaningful. Start by clustering and mapping your own data and checking the groups against what you know.

If you come from data science or ML

If you mostly train supervised models, the shift is in evaluation: with no labels, you judge results by stability, by downstream performance and by domain experts. Learn how the domain describes its own categories before naming clusters.

Roles that do this work: Data scientistMachine learning engineerResearch scientistComputational biologistNLP engineer

Tools you will use

ToolWhat you use it for
scikit-learn clusteringRun k-means, HDBSCAN, Gaussian mixtures and PCA on tabular or embedded data.
UMAPProject high-dimensional data into two dimensions to inspect cluster structure.
PyTorchTrain autoencoders and other models that learn representations without labels.
pandasProfile cluster members and compare their feature averages.

Public data to practise on

  • Fashion-MNIST: Greyscale images of clothing in ten categories; hide the labels, cluster, then check the groups against them.
  • Wholesale Customers (UCI): Annual spending by product category for a distributor's clients, for customer segmentation.

Your first project

Download Fashion-MNIST, cluster the images with k-means on PCA features while ignoring the labels, and compare the clusters with random assignment using the adjusted Rand index against the true categories.

Keep the result, your code and a short note on what didn't work. That record is worth more than the score.

Common questions

What is unsupervised learning?
Unsupervised learning finds structure in data without target labels, such as groups, low-dimensional maps or unusual points. Clustering and dimensionality reduction are the most common examples.
How do you evaluate a model without labels?
Use internal measures such as silhouette score, check that results are stable across samples, test whether the output improves a downstream task, and ask domain experts to review examples.
What is the difference between unsupervised and self-supervised learning?
Unsupervised learning usually means clustering or density estimation. Self-supervised learning builds a prediction task from the data itself, such as predicting a masked word, and is how large language and vision models are pretrained.
Can I train a classifier with only a few labels?
Often, yes. Semi-supervised learning, weak supervision and fine-tuning a pretrained model can reach useful performance with far fewer labels than training from scratch.

First Principles, the SchoolWhool newsletter

One machine learning idea, explained properly, every week.

The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.

Learn the machine learning behind it, from first principles.

Start with Python from zero, free. Every stage after that builds on the last, and a person answers your doubts.