Classification: telling which group it is
Earlier we drew a line through points to predict a value. But sometimes the question is different. Is this letter spam or not, is this photo a cat or a dog. We are not guessing a single number, we are telling which group it falls into. Telling groups apart like this is classification.
Two groups gather apart
Say points are scattered about.
Not plain points, but two colors mixed in.
One color is spam letters,
the other is normal letters.
Look closely and the same colors
gather in similar spots.
Spam with spam, normal with normal.
That is what forming a group means.
So how can we tell the two apart?
Tap to spread out the points. The same colors gather in similar spots, and two groups emerge.
The two groups are easy to see.
One color sits at the lower left,
the other gathers at the upper right.
The human eye splits them at a glance.
But to ask a computer to do this,
we need a clear rule, not eyeballing.
Up to where is one side,
and from where is the other side?
Drawing one line would make it clean, right?
Draw a boundary between them
Draw one line between the two groups.
We call this line the boundary.
One side of the line is one group's land,
the other side is the other group's land.
A good boundary
splits the two groups cleanly.
The same color should not cross the line.
A badly placed line lets colors mix,
so it must be set in a good spot.
Tap to move the boundary line. Find the spot that splits the two groups cleanly and both sides separate clearly.
The boundary split the two groups.
Now we can say clearly
that the left of the line is one group
and the right is the other.
It is no longer eyeballing, but a rule.
This single line is the heart of classification.
So a brand new point we have not seen,
which group should it go into?
A new point goes by which side
Say a new letter arrives.
We do not yet know if it is spam or normal.
Still, we can tell roughly where it sits.
Just see which side of the boundary that spot is on.
If it lands on the left, the left group;
if on the right, the right group.
No need to weigh every detail,
one position decides the group.
This is how classification sorts something new.
Tap an empty area to drop a new point. Its color, its group, is decided by which side of the boundary it lands on.
The new point got its color by where it sat.
Left of the boundary, the left color;
right of it, the right color.
The rule is simple and steady.
Even if a hundred new points come,
we sort each one by the same rule.
But the world does not have only two groups.
Like cat, dog, bird,
what do we do when there are three or more?
Three or more need more boundaries
With three groups, one line is not enough.
A single line splits the land into only two.
Then we just draw more boundaries.
Draw a few lines
to divide the land into three or four regions.
Each region becomes one group's land.
A new point is sorted the same way,
by which region it lands in.
More groups, but the idea stays the same.
Tap to add boundaries one by one. The land splits from two regions into three and four, and each group gets its own region.
Even with more regions, the rule held steady.
Draw more boundaries to split regions,
and sort a new point by which region it is in.
Two groups or four,
the underlying idea is the same.
Draw boundaries between the points
and decide the group by position.
Now shall we look back
over the whole of classification at once?
Let's wrap up
Gathered on one line, it is this.
Classification is about telling which group it is.
Unlike regression, which guesses a value,
it answers which of the groups it is.
Draw a boundary between the two groups,
and sort a new point by which side it is on.
If there are three or more groups, draw more boundaries.
Deciding the group by a single position,
that is classification.
Tap the key points in order to review. (split into two groups -> a boundary between -> a new point by which side -> three or more, more boundaries)
Now you hold the idea of classification,
telling which group something is.
After regression that guessed a value,
you have seen the path of splitting groups too.
The two only ask different questions;
both find a rule among the points.
Next, let's go on together
toward how a machine can learn
to do this splitting better on its own.