1.5 Machine Learning Overview | Supervised learning part 2 --[Machine Learning | Andrew Ng]
 So, supervised learning algorithms learn to predict input-output or x-to-y mappings, and in the last video you saw that regression algorithms, which is a type of supervised learning algorithm, learn to predict numbers out of infinitely many possible numbers. There's a second major type of supervised learning algorithm called a classification algorithm. Let's take a look at what this means. Take breast cancer detection as an example of a classification problem. Say you're building a machine learning system so that doctors can have a diagnostic tool to detect breast cancer. This is important because early detection could potentially save a patient's life. Using a patient's medical records, your machine learning system tries to figure out if a tumor that is a lump is malignant, meaning cancerous or dangerous, or if that tumor, that lump, is benign, meaning that it's just a lump that isn't cancerous and isn't that dangerous. Some of my friends have actually been working on this specific problem. So maybe your dataset has tumors of various sizes, and these tumors are labeled as either benign, which I will designate in this example with a zero, or malignant, which I'll designate in this example with a one. You can then plot your data on a graph like this, where the horizontal axis represents the size of the tumor and the vertical axis takes on only two values, zero or one, depending on whether the tumor is benign, zero, or malignant, one. One reason that this is different from regression is that we're trying to predict only a small number of possible outputs or categories. In this case, two possible outputs, zero or one, benign or malignant. This is different from regression, which tries to predict any number out of an infinitely many number of possible numbers. And so the fact that there are only two possible outputs is what makes this classification. Because there are only two possible outputs or two possible categories in this example, you can also plot this dataset on a line like this, where now I'm going to use two different symbols to denote the category using a circle or an O to denote the benign examples and a cross to denote the malignant examples. And if a new patient walks in for a diagnosis and they have a lump that is this size, then the question is, will your system classify this tumor as benign or malignant? It turns out that in classification problems, you can also have more than two possible output categories. Maybe your learning algorithm can output multiple types of cancer diagnoses if it turns out to be malignant. So let's call two different types of cancer type one and type two. In this case, the algorithm would have three possible output categories it could predict. And by the way, in classification, the terms output classes and output categories are often used interchangeably, so when I say class or category, when referring to the output, it means the same thing. So to summarize, classification algorithms predict categories. Categories don't have to be numbers. It could be non-numeric. For example, it can predict whether a picture is that of a cat or a dog. And it can predict if a tumor is benign or malignant. Categories can also be numbers like zero or one or zero or one or two. But what makes classification different from regression when you're interpreting the numbers is that classification predicts a small, finite, limited set of possible output categories such as zero, one and two, but not all possible numbers in between like 0.5 or 1.7. In the example of supervised learning that we've been looking at, we had only one input value, the size of the tumor. But you can also use more than one input value to predict an output. Here's an example, instead of just knowing the tumor size, say you also have each patient's age in years. Your new data set now has two inputs, age and tumor size. Plotting this new data set, we're going to use circles to show patients whose tumors are benign and crosses to show the patients with a tumor that was malignant. So when a new patient comes in, the doctor can measure the patient's tumor size and also record the patient's age. And so given this, how can we predict if this patient's tumor is benign or malignant? Well, given a data set like this, what the learning algorithm might do is find some boundary that separates out the malignant tumors from the benign ones. So the learning algorithm has to decide how to fit a boundary line to this data. The boundary line found by the learning algorithm will help the doctor with the diagnosis. In this case, the tumor is more likely to be benign. From this example, we've seen how two inputs, the patient's age and tumor size can be used. In other machine learning problems, often many more input values are required. My friends who worked on breast cancer detection use many additional inputs like the thickness of the tumor clump, uniformity of the cell size, uniformity of the cell shape, and so on. So to recap, supervised learning maps input X to output Y, where the learning algorithm learns from the quote, right answers. The two major types of supervised learning are regression and classification. In a regression application, like predicting prices of houses, the learning algorithm has to predict numbers from infinitely many possible output numbers. Whereas in classification, the learning algorithm has to make a prediction of a category, all of a small set of possible outputs. So you now know what is supervised learning, including both regression and classification. I hope you're having fun. Next, there's a second major type of machine learning called unsupervised learning. Let's go on to the next video to see what that is.
[{"start": 0.0, "end": 9.48, "text": " So, supervised learning algorithms learn to predict input-output or x-to-y mappings, and"}, {"start": 9.48, "end": 14.280000000000001, "text": " in the last video you saw that regression algorithms, which is a type of supervised"}, {"start": 14.280000000000001, "end": 19.64, "text": " learning algorithm, learn to predict numbers out of infinitely many possible numbers."}, {"start": 19.64, "end": 24.92, "text": " There's a second major type of supervised learning algorithm called a classification"}, {"start": 24.92, "end": 25.92, "text": " algorithm."}, {"start": 25.92, "end": 29.34, "text": " Let's take a look at what this means."}, {"start": 29.34, "end": 35.519999999999996, "text": " Take breast cancer detection as an example of a classification problem."}, {"start": 35.519999999999996, "end": 39.72, "text": " Say you're building a machine learning system so that doctors can have a diagnostic tool"}, {"start": 39.72, "end": 41.8, "text": " to detect breast cancer."}, {"start": 41.8, "end": 47.16, "text": " This is important because early detection could potentially save a patient's life."}, {"start": 47.16, "end": 52.44, "text": " Using a patient's medical records, your machine learning system tries to figure out if a tumor"}, {"start": 52.44, "end": 60.16, "text": " that is a lump is malignant, meaning cancerous or dangerous, or if that tumor, that lump,"}, {"start": 60.16, "end": 67.08, "text": " is benign, meaning that it's just a lump that isn't cancerous and isn't that dangerous."}, {"start": 67.08, "end": 71.4, "text": " Some of my friends have actually been working on this specific problem."}, {"start": 71.4, "end": 78.6, "text": " So maybe your dataset has tumors of various sizes, and these tumors are labeled as either"}, {"start": 78.6, "end": 85.88, "text": " benign, which I will designate in this example with a zero, or malignant, which I'll designate"}, {"start": 85.88, "end": 88.96, "text": " in this example with a one."}, {"start": 88.96, "end": 95.44, "text": " You can then plot your data on a graph like this, where the horizontal axis represents"}, {"start": 95.44, "end": 102.46, "text": " the size of the tumor and the vertical axis takes on only two values, zero or one, depending"}, {"start": 102.46, "end": 108.52, "text": " on whether the tumor is benign, zero, or malignant, one."}, {"start": 108.52, "end": 116.24, "text": " One reason that this is different from regression is that we're trying to predict only a small"}, {"start": 116.24, "end": 119.44, "text": " number of possible outputs or categories."}, {"start": 119.44, "end": 124.91999999999999, "text": " In this case, two possible outputs, zero or one, benign or malignant."}, {"start": 124.91999999999999, "end": 130.38, "text": " This is different from regression, which tries to predict any number out of an infinitely"}, {"start": 130.38, "end": 135.1, "text": " many number of possible numbers."}, {"start": 135.1, "end": 142.0, "text": " And so the fact that there are only two possible outputs is what makes this classification."}, {"start": 142.0, "end": 148.44, "text": " Because there are only two possible outputs or two possible categories in this example,"}, {"start": 148.44, "end": 155.44, "text": " you can also plot this dataset on a line like this, where now I'm going to use two different"}, {"start": 155.44, "end": 163.54, "text": " symbols to denote the category using a circle or an O to denote the benign examples and"}, {"start": 163.54, "end": 168.04, "text": " a cross to denote the malignant examples."}, {"start": 168.04, "end": 175.68, "text": " And if a new patient walks in for a diagnosis and they have a lump that is this size, then"}, {"start": 175.68, "end": 183.23999999999998, "text": " the question is, will your system classify this tumor as benign or malignant?"}, {"start": 183.23999999999998, "end": 188.5, "text": " It turns out that in classification problems, you can also have more than two possible output"}, {"start": 188.5, "end": 190.5, "text": " categories."}, {"start": 190.5, "end": 195.52, "text": " Maybe your learning algorithm can output multiple types of cancer diagnoses if it turns out"}, {"start": 195.52, "end": 197.94, "text": " to be malignant."}, {"start": 197.94, "end": 202.88, "text": " So let's call two different types of cancer type one and type two."}, {"start": 202.88, "end": 210.36, "text": " In this case, the algorithm would have three possible output categories it could predict."}, {"start": 210.36, "end": 216.82, "text": " And by the way, in classification, the terms output classes and output categories are often"}, {"start": 216.82, "end": 222.32, "text": " used interchangeably, so when I say class or category, when referring to the output,"}, {"start": 222.32, "end": 224.56, "text": " it means the same thing."}, {"start": 224.56, "end": 231.44, "text": " So to summarize, classification algorithms predict categories."}, {"start": 231.44, "end": 233.12, "text": " Categories don't have to be numbers."}, {"start": 233.12, "end": 234.12, "text": " It could be non-numeric."}, {"start": 234.12, "end": 242.22, "text": " For example, it can predict whether a picture is that of a cat or a dog."}, {"start": 242.22, "end": 247.84, "text": " And it can predict if a tumor is benign or malignant."}, {"start": 247.84, "end": 253.28, "text": " Categories can also be numbers like zero or one or zero or one or two."}, {"start": 253.28, "end": 258.64, "text": " But what makes classification different from regression when you're interpreting the numbers"}, {"start": 258.64, "end": 265.8, "text": " is that classification predicts a small, finite, limited set of possible output categories"}, {"start": 265.8, "end": 274.84000000000003, "text": " such as zero, one and two, but not all possible numbers in between like 0.5 or 1.7."}, {"start": 274.84000000000003, "end": 279.76, "text": " In the example of supervised learning that we've been looking at, we had only one input"}, {"start": 279.76, "end": 285.48, "text": " value, the size of the tumor."}, {"start": 285.48, "end": 291.52, "text": " But you can also use more than one input value to predict an output."}, {"start": 291.52, "end": 297.71999999999997, "text": " Here's an example, instead of just knowing the tumor size, say you also have each patient's"}, {"start": 297.71999999999997, "end": 299.79999999999995, "text": " age in years."}, {"start": 299.79999999999995, "end": 305.24, "text": " Your new data set now has two inputs, age and tumor size."}, {"start": 305.24, "end": 309.88, "text": " Plotting this new data set, we're going to use circles to show patients whose tumors"}, {"start": 309.88, "end": 317.84, "text": " are benign and crosses to show the patients with a tumor that was malignant."}, {"start": 317.84, "end": 322.88, "text": " So when a new patient comes in, the doctor can measure the patient's tumor size and also"}, {"start": 322.88, "end": 325.88, "text": " record the patient's age."}, {"start": 325.88, "end": 332.15999999999997, "text": " And so given this, how can we predict if this patient's tumor is benign or malignant?"}, {"start": 332.15999999999997, "end": 338.67999999999995, "text": " Well, given a data set like this, what the learning algorithm might do is find some boundary"}, {"start": 338.67999999999995, "end": 344.62, "text": " that separates out the malignant tumors from the benign ones."}, {"start": 344.62, "end": 350.76, "text": " So the learning algorithm has to decide how to fit a boundary line to this data."}, {"start": 350.76, "end": 356.0, "text": " The boundary line found by the learning algorithm will help the doctor with the diagnosis."}, {"start": 356.0, "end": 361.32, "text": " In this case, the tumor is more likely to be benign."}, {"start": 361.32, "end": 367.52, "text": " From this example, we've seen how two inputs, the patient's age and tumor size can be used."}, {"start": 367.52, "end": 373.4, "text": " In other machine learning problems, often many more input values are required."}, {"start": 373.4, "end": 378.03999999999996, "text": " My friends who worked on breast cancer detection use many additional inputs like the thickness"}, {"start": 378.03999999999996, "end": 383.15999999999997, "text": " of the tumor clump, uniformity of the cell size, uniformity of the cell shape, and so"}, {"start": 383.15999999999997, "end": 384.15999999999997, "text": " on."}, {"start": 384.15999999999997, "end": 392.2, "text": " So to recap, supervised learning maps input X to output Y, where the learning algorithm"}, {"start": 392.2, "end": 395.84, "text": " learns from the quote, right answers."}, {"start": 395.84, "end": 401.59999999999997, "text": " The two major types of supervised learning are regression and classification."}, {"start": 401.6, "end": 406.44, "text": " In a regression application, like predicting prices of houses, the learning algorithm has"}, {"start": 406.44, "end": 411.08000000000004, "text": " to predict numbers from infinitely many possible output numbers."}, {"start": 411.08000000000004, "end": 416.08000000000004, "text": " Whereas in classification, the learning algorithm has to make a prediction of a category, all"}, {"start": 416.08000000000004, "end": 419.32000000000005, "text": " of a small set of possible outputs."}, {"start": 419.32000000000005, "end": 425.56, "text": " So you now know what is supervised learning, including both regression and classification."}, {"start": 425.56, "end": 427.24, "text": " I hope you're having fun."}, {"start": 427.24, "end": 433.08, "text": " Next, there's a second major type of machine learning called unsupervised learning."}, {"start": 433.08, "end": 460.44, "text": " Let's go on to the next video to see what that is."}]