[MUSIC] So we have the representation of the hypotheses in terms of rules. Right, each rule is a hypothesis. Okay, so that's the representation. We now we need the evaluation. How do we determine which ones are good and which ones aren't? Well one thing you can do is construct a confusion matrix. Which is a square matrix with a number of rows and columns for each unique label. Each unique class label. And the diagonal of the confusion matrix will tell you which labels you got right. Okay. So for example, here. Using this one simple rule that looked pretty good when we drew the scatter plot. IF sex='female' THEN survive=yes otherwise no. We have 468 instances where we classified the passenger as having not survived and indeed they had not survived. We have 233 cases where we classified them as having survived and they did indeed survive. And the other values are when we, are the mistakes that we made. We classified 109 as having survived, who actually did not and we classified 81 as not having survived who actually did. Okay. So this is actually useful for sort of visual inspection, but it doesn't really give you a single number that you need in order to actually build a program that would do this automatically. So what you can also do is measure the accuracy which is here, you know, 468 + 233, the number we got right, over the total number covered by the rule. And in fact, we didn't have any missing values with male or female, so they're all covered by the rule, is about 79% correct and 21% incorrect. So this is not too bad given that it's such a simple model. Okay. Fine, so another scatter plot we could look at, maybe in an attempt to improve upon it is, look at whether they were in first class, second class, or third class. And here, we don't have sex on here which was a pretty strong indicator, but we do see some interesting patterns. It looks like people in the first class tended to survive more. Certainly more than the people in third class. And then it looks like the kids in second class tended to survive more than the adults in second class. So this suggests a slightly more complicated rule, okay? But here is just another example of a simple rule just for class itself. If you're in first class, then you survive, if you're in second class, then you survive but if you're in third class, then you don't. And so now, the confusion matrix we can build again. And remember the confusion matrix is just the class label, so it's still just no and yes and no and yes, and how did we do here? Well, the diagonal tells us, 372 + 223 over the total number is only 67% correct. So it's a little bit worse. Okay, so we have a representation of hypotheses and we have an evaluation method, but we need something that's kind of a search strategy to consider all these rules. And so for the one rule case, you conceivably could just enumerate all of them. And so one potential search strategy, maybe I hesitate to call it optimization, is just to do so. So the 1-Rule algorithm is this. For each attribute A and for each value of that attribute, create the rule. Count how often each class appears, find the most frequent class, and generate a rule if A=V, then Class=C. Okay, and then you can calculate the error rate of that rule. Pick the attribute whose set of rules produce the lowest error rate overall. All right, and now you'll have 1-Rule. Now, by the way, 1-Rule, again, refers to actually an attribute. So it's an if then, if then, if then, if then, covering all the values of that attribute, not just, for male and female that's not two rules, that's just one rule. Okay. So this is kind of an exhaustive search strategy for which to generate these rules. [MUSIC]