5.6 Multiclass Classification | Multiclass --[Machine Learning | Andrew Ng]
 Multi-class classification refers to classification problems where you can have more than just two possible output labels, so not just zero or one. Let's take a look at what that means. For the handwritten digit classification problems we've looked at so far, we were just trying to distinguish between the handwritten digits zero and one. But if you're trying to read postal codes or zip codes on an envelope, well there are actually 10 possible digits you might want to recognize. Or alternatively, in the first course you saw the example if you're trying to classify whether a patient may have any of three or five different possible diseases, that too would be a multi-class classification problem. For one thing I've worked on a lot is visual defect inspection of parts manufactured in the factory, where you might look at a picture of a pill that a pharmaceutical company has manufactured and try to figure out does it have a scratch defect or discoloration defect or a chip defect. And this would again be multiple classes of multiple different types of defects that you could classify this pill as having. So a multi-class classification problem is still a classification problem in that Y can take on only a small number of discrete categories, it's not any number, but now Y can take on more than just two possible values. So whereas previously for binary classification you may have had a data set like this with features X1 and X2, in which case logistic regression would fit a model to estimate what's the probability of Y being 1 given the features X because Y was either 0 or 1. With multi-class classification problems you would instead have a data set that maybe looks like this, where we have four classes where the O's represent one class, the X's represent another class, the triangles represent the third class, and the squares represent the fourth class. And instead of just estimating the chance of Y being equal to 1, we'll now want to estimate what's the chance of Y is equal to 1, or what's the chance of Y is equal to 2, or what's the chance of Y is equal to 3, or the chance of Y being equal to 4. And it turns out that the algorithm you learn about in the next video can learn a decision boundary that maybe looks like this, that divides the space X1 and X2 into four categories rather than just two categories. So that's the definition of the multi-class classification problem. In the next video we'll look at the softmax regression algorithm, which is a generalization of the logistic regression algorithm, and using that you'll be able to carry out multi-class classification problems. And after that we'll take softmax regression and fit it into a new neural network so that you also be able to train a neural network to carry out multi-class classification problems. Let's go on to the next video.
[{"start": 0.0, "end": 7.96, "text": " Multi-class classification refers to classification problems where you can have more than just"}, {"start": 7.96, "end": 13.52, "text": " two possible output labels, so not just zero or one."}, {"start": 13.52, "end": 15.74, "text": " Let's take a look at what that means."}, {"start": 15.74, "end": 20.900000000000002, "text": " For the handwritten digit classification problems we've looked at so far, we were just trying"}, {"start": 20.900000000000002, "end": 25.98, "text": " to distinguish between the handwritten digits zero and one."}, {"start": 25.98, "end": 30.6, "text": " But if you're trying to read postal codes or zip codes on an envelope, well there are"}, {"start": 30.6, "end": 36.0, "text": " actually 10 possible digits you might want to recognize."}, {"start": 36.0, "end": 44.22, "text": " Or alternatively, in the first course you saw the example if you're trying to classify"}, {"start": 44.22, "end": 49.900000000000006, "text": " whether a patient may have any of three or five different possible diseases, that too"}, {"start": 49.900000000000006, "end": 53.400000000000006, "text": " would be a multi-class classification problem."}, {"start": 53.4, "end": 60.0, "text": " For one thing I've worked on a lot is visual defect inspection of parts manufactured in"}, {"start": 60.0, "end": 66.36, "text": " the factory, where you might look at a picture of a pill that a pharmaceutical company has"}, {"start": 66.36, "end": 72.36, "text": " manufactured and try to figure out does it have a scratch defect or discoloration defect"}, {"start": 72.36, "end": 74.6, "text": " or a chip defect."}, {"start": 74.6, "end": 79.56, "text": " And this would again be multiple classes of multiple different types of defects that you"}, {"start": 79.56, "end": 83.48, "text": " could classify this pill as having."}, {"start": 83.48, "end": 88.0, "text": " So a multi-class classification problem is still a classification problem in that Y can"}, {"start": 88.0, "end": 96.2, "text": " take on only a small number of discrete categories, it's not any number, but now Y can take on"}, {"start": 96.2, "end": 100.0, "text": " more than just two possible values."}, {"start": 100.0, "end": 106.32000000000001, "text": " So whereas previously for binary classification you may have had a data set like this with"}, {"start": 106.32, "end": 113.6, "text": " features X1 and X2, in which case logistic regression would fit a model to estimate what's"}, {"start": 113.6, "end": 121.96, "text": " the probability of Y being 1 given the features X because Y was either 0 or 1."}, {"start": 121.96, "end": 126.83999999999999, "text": " With multi-class classification problems you would instead have a data set that maybe looks"}, {"start": 126.83999999999999, "end": 133.2, "text": " like this, where we have four classes where the O's represent one class, the X's represent"}, {"start": 133.2, "end": 138.76, "text": " another class, the triangles represent the third class, and the squares represent the"}, {"start": 138.76, "end": 140.56, "text": " fourth class."}, {"start": 140.56, "end": 145.48, "text": " And instead of just estimating the chance of Y being equal to 1, we'll now want to estimate"}, {"start": 145.48, "end": 151.83999999999997, "text": " what's the chance of Y is equal to 1, or what's the chance of Y is equal to 2, or what's the"}, {"start": 151.83999999999997, "end": 158.83999999999997, "text": " chance of Y is equal to 3, or the chance of Y being equal to 4."}, {"start": 158.84, "end": 164.0, "text": " And it turns out that the algorithm you learn about in the next video can learn a decision"}, {"start": 164.0, "end": 171.56, "text": " boundary that maybe looks like this, that divides the space X1 and X2 into four categories"}, {"start": 171.56, "end": 174.76, "text": " rather than just two categories."}, {"start": 174.76, "end": 179.52, "text": " So that's the definition of the multi-class classification problem."}, {"start": 179.52, "end": 185.54, "text": " In the next video we'll look at the softmax regression algorithm, which is a generalization"}, {"start": 185.54, "end": 192.12, "text": " of the logistic regression algorithm, and using that you'll be able to carry out multi-class"}, {"start": 192.12, "end": 194.32, "text": " classification problems."}, {"start": 194.32, "end": 200.48, "text": " And after that we'll take softmax regression and fit it into a new neural network so that"}, {"start": 200.48, "end": 206.32, "text": " you also be able to train a neural network to carry out multi-class classification problems."}, {"start": 206.32, "end": 216.35999999999999, "text": " Let's go on to the next video."}]