Learning from examples / 1 of 7

Supervised and unsupervised learning

8 minOpening your notebook…

What you’ll learn

  • Explain the main idea of “Supervised and unsupervised learning” in your own words.
  • Trace a concrete example and identify the assumptions behind it.
  • Apply the principle in a practice problem and recognize a common failure.

The idea, intuitively

Supervised learning uses examples with target labels. Unsupervised learning searches for structure without those targets. Neither approach removes the need to define what a useful result means.

Think of the dataset as a sample from a larger environment. A useful model must transfer beyond that sample. Keep training choices separate from final evaluation, and compare against a simple baseline. Before selecting an algorithm, inspect what the labels mean and which errors matter to the user.

Under the hood

A supervised loss compares predictions with labels. Clustering instead groups examples using a chosen representation and distance. The structure discovered depends strongly on feature scaling and modeling assumptions.

A useful caution

A discovered cluster is not automatically a meaningful real-world category.

A worked example

Predicting a known product category is supervised. Grouping customers by purchasing patterns without predefined categories is unsupervised.

Imagine three baskets containing 1, 2, and 10 books. A simple distance-based grouping with two clusters might put 1 and 2 together and leave 10 on its own. If you add total spending as a feature, the grouping may change depending on how you scale the two features. The distance and features help define what “similar” means.

How to use this way of thinking

Define the target, split the data, fit preprocessing only on training examples, and evaluate a baseline. Inspect individual failures alongside aggregate metrics. Change one major choice at a time and use validation evidence to decide whether the additional complexity earns its place.

Try it yourself

You have transaction data but no fraud labels. What can clustering establish?

Key takeaways

  • Training a classifier on labeled messages
  • A discovered cluster is not automatically a meaningful real-world category.
  • Check the assumptions with a small example before applying this idea to a larger system.

Check your understanding

0/2 checked

Use feedback to learn. Quiz scores and lesson completion are tracked separately.

1Which task needs labeled targets during fitting?
2True or false: A discovered cluster automatically identifies a meaningful real-world category.
Go to lesson completion

Further reading

Original papers and reference material for this school. External resources may be in English and require internet access.

Google Machine Learning Crash Course (opens a new tab)scikit-learn user guide (opens a new tab)

Finish this lesson

Mark this lesson complete when you’re ready to continue.

Start with a question

Introduction to AIAI FoundationsA brief history of AIAI FoundationsTypes of AIAI FoundationsAI, ML, and deep learningAI FoundationsUnderstanding generative AIAI FoundationsEthics, limitations, and responsibilityAI FoundationsLinear algebra for learning systemsMathematics for AIVectors, matrices, and similarityMathematics for AICalculus: measuring changeMathematics for AIDerivatives and gradientsMathematics for AIProbability and statisticsMathematics for AIOptimization and objectivesMathematics for AI
K to open · Escape to close