Nathan
← Back to articles

Supervised vs Unsupervised Learning - My Notes So Far

machine-learningsupervised-learningunsupervised-learninglearn-in-public

Supervised vs Unsupervised Learning: My Notes So Far

Supervised vs Unsupervised Learning Photo by Kevin Ku on Unsplash

I've been working through Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow by Aurélien Géron lately, picking up concepts alongside my day job as a software engineer. Most of what I read doesn't stick unless I write it down in my own words, so this article is exactly that — my notes, cleaned up and posted here in case they're useful to someone else starting from the same place.

This one's about the two most fundamental categories in machine learning: supervised and unsupervised learning.


The Core Difference

The simplest way I can put it: supervised learning trains on data that already has the right answers attached. Unsupervised learning gets the data without any answers and has to figure things out on its own.

That's the whole idea in one sentence, but let me break it down a bit more.


Supervised Learning

When you train a supervised model, every example in your dataset comes with a label. The model's job is to learn the relationship between the input (called features) and the output (called labels), so that when it sees new data it has never encountered before, it can make a reasonable prediction.

The classic example is spam detection. You feed the model thousands of emails, each one already marked as either "spam" or "not spam." Over time, the model picks up on patterns — certain words, sender patterns, formatting quirks — and learns to classify new emails on its own.

Another common example is house price prediction. You give the model a dataset of homes with attributes like square footage, number of bedrooms, and location, alongside the actual sale prices. The model learns how those features relate to price, and can then estimate the value of a house it has never seen.

Supervised learning generally breaks down into two types of tasks:

  • Classification — predicting a category. Spam or not spam. Dog or cat. Fraud or legitimate transaction.
  • Regression — predicting a number. Price. Score. Temperature.

The key ingredient in both cases is labeled data. Someone (or some process) has to have already done the work of tagging each example with the correct answer before the model ever sees it.


Unsupervised Learning

Unsupervised learning is the other side of the coin. The model gets raw data with no labels at all — no right answers, no guidance. Its only job is to find structure in that data on its own.

This is genuinely interesting to think about as a software engineer, because there's no "correct output" you can check against. The model has to discover patterns by itself.

A few common tasks that fall under unsupervised learning:

  • Clustering — grouping similar things together. Think about segmenting blog readers by their behavior: some only read technical posts, others prefer shorter opinion pieces, and so on. The model surfaces those groups without you having to define them upfront.
  • Dimensionality reduction and visualization — taking a dataset with dozens or hundreds of variables and compressing it down into something you can actually visualize, like a 2D plot. This is useful for getting a feel for the structure of your data before you do anything else with it.
  • Anomaly detection — identifying examples that don't look like the rest. Credit card fraud detection is the go-to example here. Most transactions follow predictable patterns, so unusual ones stand out.
  • Association rule learning — discovering co-occurrence patterns. The classic retail example: people who buy chips and BBQ sauce also tend to buy steak. No one told the model to look for that; it found it by looking at enough transaction data.

A Mental Model That Helped Me

When I first read about this distinction, the analogy that came to my mind was thinking about it in terms of a teacher.

With supervised learning, you have a teacher. The teacher gives you practice problems and the correct answers. You study those pairs until you can reliably produce the right answer on a new problem.

With unsupervised learning, there's no teacher. You're handed a pile of material and told to make sense of it yourself. You start noticing which things seem similar, which ones look out of place, which combinations show up together. The structure you find is genuine — it was in the data — but nobody told you what to look for.


Why This Matters for Engineers

As a software engineer getting into ML, I think this distinction matters more than it might initially seem. The type of learning you use shapes everything downstream: how you collect and prepare your data, what counts as a good result, and how you evaluate whether your model is actually working.

Labeled data is expensive. Someone has to create it, whether that's a human annotator tagging thousands of examples or a system that generates labels automatically. Supervised learning depends on that investment entirely. Unsupervised learning sidesteps it — which is part of why it's attractive at scale.

That said, unsupervised results are harder to evaluate. If there's no right answer, how do you know if the clusters your model found are meaningful? That's a real challenge, and one I expect to dig into more as I keep going.


These are early notes, and I'm sure my understanding will get more nuanced as I work through more material. But writing this out helped me solidify the distinction, and maybe it'll be a useful starting point for someone else in the same spot.

More notes to come.