Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Types of Machine Learning  ›  Lesson

Unsupervised Learning

Unsupervised Learning 14 minUnsupervised learning works on data with no labels and looks for structure: groups of similar items, a few directions that capture most variation, or items that do not fit.

Unsupervised Learning

The agency has 5,000 listings and a vague question: "What kinds of flats do we actually have?" Nobody has labelled them as "budget", "family" or "luxury", and nobody knows how many kinds there are. Unsupervised learning works exactly here, on data with no answer key.

The rule

No labels: the model finds structure, such as groups, directions or oddities.

Three jobs cover most unsupervised work:

  • Clustering: put similar items into groups. Flats might fall into small-and-cheap, mid-size-near-metro and large-and-pricey. k-means is the classic method: choose kk starting centres, assign every item to its nearest centre, move each centre to the average of its members, and repeat until nothing changes.
  • Dimensionality reduction: describe each item with fewer numbers while keeping most of the variation. Principal component analysis (PCA) uses the eigenvectors from the linear algebra section as new axes and keeps only the ones with the largest eigenvalues. Forty listing features might shrink to three, making the data easier to plot and faster to model.
  • Anomaly detection: flag items that fit no pattern. A listing claiming 40 m² for ₹80 thousand, on a street where similar flats rent for 14 to 16, stands out.

Because there are no labels, there is no accuracy score. You judge the result by whether it is useful: do the clusters make sense to the letting team, and do the flagged listings turn out to be errors or fraud?

The shortcut

Is there a label column? If not, ask what you want: groups, fewer numbers, or oddities. That names the job: clustering, dimensionality reduction or anomaly detection.

Here is one round of k-means on the five flat sizes, 40, 50, 60, 70 and 80, with two clusters.

One round of k-means on flat sizesStep 1 of 4
  1. Start

    Pick starting centres at 42 and 72.

The choice of kk is yours, and a different kk gives different groups. That is not a bug; it is why the result must be judged by usefulness.

Drills

Answer fast — trust the rule.

quick drill

Group 5,000 listings into segments when nobody has defined the segments. Which job is this?

quick drill

After one round of k-means on sizes 40, 50, 60, 70, 80 from centres 42 and 72, where are the new centres?

quick drill

Shrink 40 listing features to 3 while keeping most of the variation. Which job is this?

quick drill

A listing claims 40 m² for ₹80 thousand where similar flats rent for 14 to 16. Which job would catch it?

quick drill

Why is judging a clustering harder than judging a classifier?

Remember

  • No labels: the model finds structure, such as groups, directions or oddities.
  • Shortcut: no label column? Decide between groups, fewer numbers or oddities.
  • Trap: expecting an accuracy score, or treating one choice of k as the truth.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainTwo clusters by hand

Run one round of k-means on the flat sizes 40, 50, 60, 70 and 80 with starting centres 42 and 72. Explain each step, give the new centres, and say why there is no accuracy score to check the result against.