1 00:00:00,287 --> 00:00:04,350 [MUSIC] 2 00:00:04,350 --> 00:00:06,710 We've now learned decision trees from data. 3 00:00:06,710 --> 00:00:09,300 Let's look at how we can make predictions from it. 4 00:00:09,300 --> 00:00:14,010 So given the model that we've learned from the data, we're going to predict y hat. 5 00:00:14,010 --> 00:00:17,530 As we discussed in the beginning of the module, it's a pretty simple process 6 00:00:17,530 --> 00:00:21,050 of traversing down the tree in order to make that prediction. 7 00:00:21,050 --> 00:00:25,410 Given that particular input xi, so going back to that first example where Credit 8 00:00:25,410 --> 00:00:29,420 was poor, Income was high, and the Term was 5 years, we go down the branch of 9 00:00:29,420 --> 00:00:34,090 the decision tree that is associated with those particular inputs, and 10 00:00:34,090 --> 00:00:38,670 we make a prediction that y hat i is Safe. 11 00:00:38,670 --> 00:00:40,630 This would be explicit, 12 00:00:40,630 --> 00:00:45,240 even that prediction algorithm is what's called a recursive algorithm. 13 00:00:45,240 --> 00:00:47,780 I'm trying to predict, for a particular decision tree, 14 00:00:47,780 --> 00:00:52,010 I start with the top node and my input set. 15 00:00:52,010 --> 00:00:54,810 And then I say, if the current node is a leaf, return, 16 00:00:54,810 --> 00:00:57,040 predict whatever is on that leaf. 17 00:00:57,040 --> 00:01:01,150 If it's not a leaf, then pick the child that agrees with the input and 18 00:01:01,150 --> 00:01:02,810 then recurse on that child. 19 00:01:02,810 --> 00:01:06,140 So return the prediction the child makes. 20 00:01:06,140 --> 00:01:10,675 And then that process is going to unroll that path down the tree in order 21 00:01:10,675 --> 00:01:12,357 to make the prediction. 22 00:01:12,357 --> 00:01:16,739 [MUSIC]