1 00:00:01,530 --> 00:00:05,380 So now let us see how to create a random forest model in our. 2 00:00:07,470 --> 00:00:11,610 Again, to create random forest model, we need to use the package. 3 00:00:11,760 --> 00:00:12,570 Random forest. 4 00:00:13,250 --> 00:00:16,470 This is the same package we use to do bagging and Jawdat. 5 00:00:16,500 --> 00:00:19,380 This package is installed and it is active. 6 00:00:20,500 --> 00:00:27,160 So since this package started for me, I'll just run this Libatique a one to make sure that it is active 7 00:00:27,160 --> 00:00:27,580 for me. 8 00:00:28,810 --> 00:00:34,510 Next step is to use the land random forest function to create the model random for is the name of my 9 00:00:34,510 --> 00:00:38,230 variable, which will contain the information from this random forest function. 10 00:00:39,650 --> 00:00:41,270 The first barometer is the formula. 11 00:00:41,870 --> 00:00:48,560 This is the same collection as my dependent variable, all of that on my independent ready world data 12 00:00:48,590 --> 00:00:49,700 is brain data. 13 00:00:50,810 --> 00:00:58,400 And three is the barometer, which specifies the maximum number of threes that this model should create. 14 00:01:00,660 --> 00:01:09,780 If you remember in bagging, we used a barometer called M3 and we specified that Emtriva value should 15 00:01:09,780 --> 00:01:12,840 be equal to all the other independent variables. 16 00:01:12,960 --> 00:01:14,730 So we equated it to 17. 17 00:01:15,990 --> 00:01:23,130 In this scenario, since Random Forest considers less number of rebuild, that is a subset of the total 18 00:01:23,140 --> 00:01:24,300 predicted space. 19 00:01:25,540 --> 00:01:29,620 Therefore, either we specify Emtriva less than 17. 20 00:01:30,740 --> 00:01:37,760 So maybe we can say M3 is equal to five or embrace equal to six, something like that, or we do not 21 00:01:37,760 --> 00:01:38,660 specify anything. 22 00:01:38,780 --> 00:01:40,790 And are will use a default value. 23 00:01:41,320 --> 00:01:47,040 So by default, since this is a regression model, I will use PMA three. 24 00:01:47,750 --> 00:01:49,010 Since we have 17. 25 00:01:50,820 --> 00:01:51,720 Predictor variables. 26 00:01:51,770 --> 00:01:55,080 B by three will come out to be five point six six. 27 00:01:56,530 --> 00:01:57,520 Which is nearly six. 28 00:01:57,670 --> 00:02:01,060 So probably ordering take em crazy equal to six. 29 00:02:03,010 --> 00:02:10,090 If you want to use other value, you can just write a comma and the best way M3 is equal to some of 30 00:02:10,090 --> 00:02:11,470 that value which you want to use. 31 00:02:12,070 --> 00:02:13,030 So I love this model. 32 00:02:17,470 --> 00:02:22,070 And random forward variable has the information of the random forest model. 33 00:02:24,450 --> 00:02:31,350 Now, using the predicate function I predicted devalues and using this formula for MASC. 34 00:02:31,620 --> 00:02:34,140 I calculated the MSE for Random Forest. 35 00:02:35,820 --> 00:02:43,160 Now you can see that a messy for random forest is coming out to be 41 million, nearly four bagging, 36 00:02:43,170 --> 00:02:45,420 it was 54, 55 million. 37 00:02:45,780 --> 00:02:49,340 So you can clearly see an improvement in the model. 38 00:02:50,880 --> 00:02:57,000 There is nearly a 20 percent improvement in terms of masc of the predicted values. 39 00:02:58,980 --> 00:03:06,750 So just by changing the value of M3 in this whole process, that is instead of using Embry's equal to 40 00:03:06,750 --> 00:03:07,470 17. 41 00:03:09,010 --> 00:03:11,530 We are using embryos equal to nearly six. 42 00:03:12,040 --> 00:03:17,210 I am getting a huge improvement in prediction, accuracy of my model. 43 00:03:18,520 --> 00:03:24,140 And by the way, I hope since I'm doing bagging and rainforest's only for recreation, I hope that you're 44 00:03:24,160 --> 00:03:26,530 doing it for classification on your own. 45 00:03:27,220 --> 00:03:29,800 You know how to run that classification model. 46 00:03:30,190 --> 00:03:33,580 Only thing you need to add is another parameter here, which is method. 47 00:03:34,180 --> 00:03:38,350 So that works for bagging and random forest as well. 48 00:03:38,590 --> 00:03:44,140 So my suggestion is that you should go ahead and do this for classification also. 49 00:03:45,210 --> 00:03:48,200 And see the improvement in classification prediction accuracy. 50 00:03:49,140 --> 00:03:55,200 So do this work classification, make their confusion metrics and see the improvement in prediction, 51 00:03:55,200 --> 00:03:57,510 accuracy, using, bagging and random forest.