And a third and final example if you are using machine learning to classify

the weather, you know maybe you want to decide that the weather is sunny, cloudy,

rainy, or snow, or if it's gonna be snow, and so in all of these examples,

y can take on a small number of values, maybe one to three, one to four and

so on, and these are multiclass classification problems.

And by the way, it doesn't really matter whether we index is at 0, 1,

2, 3, or as 1, 2, 3, 4.

I tend to index my classes starting from 1 rather than starting from 0,

but either way we're off and it really doesn't matter.

Whereas previously for

a binary classification problem, our data sets look like this.

For a multi-class classification problem our data sets may look like

this where here I'm using three different symbols to represent our three classes.

So the question is given the data set with three classes where

this is an example of one class, that's an example of a different class, and

that's an example of yet a third class.

How do we get a learning algorithm to work for the setting?

We already know how to do binary classification using a regression.

We know how to you know maybe fit a straight line to set for the positive and

negative classes.

You see an idea called one-vs-all classification.

We can then take this and make it work for multi-class classification as well.

Here's how a one-vs-all classification works.

And this is also sometimes called one-vs-rest.

Let's say we have a training set like that shown on the left,

where we have three classes of y equals 1, we denote that with a triangle,

if y equals 2, the square, and if y equals three, then the cross.

What we're going to do is take our training set and

turn this into three separate binary classification problems.

I'll turn this into three separate two class classification problems.

So let's start with class one which is the triangle.

We're gonna essentially create a new sort of fake training set where classes two and

three get assigned to the negative class.

And class one gets assigned to the positive class.

You want to create a new training set like that shown on the right, and

we're going to fit a classifier which I'm going to call h subscript theta

superscript one of x where here

the triangles are the positive examples and the circles are the negative examples.

So think of the triangles being assigned the value of one and

the circles assigned the value of zero.

And we're just going to train a standard logistic regression classifier and

maybe that will give us a position boundary that looks like that.

Okay?