1 00:00:06,129 --> 00:00:22,969 so today we're gonna learn how to create make me so make me happy as a machine learning tool 2 00:00:22,969 --> 00:00:29,089 and so let's begin first of all you have to go to the machine learning for kids shortcode UK 3 00:00:29,089 --> 00:00:37,969 in your web browser and then click login if you don't have the login ID and password if you don't 4 00:00:37,969 --> 00:00:44,990 know how to set up it you can go to the setup video and look at there okay so 5 00:00:44,990 --> 00:00:55,219 I'm gonna log in and with my credentials logging it okay so once you are logged 6 00:00:55,219 --> 00:01:03,799 in you have to go to your projects and all your projects will be mentioned here 7 00:01:03,799 --> 00:01:10,239 okay so we will as you can see I have already created some projects and we 8 00:01:10,239 --> 00:01:18,950 gonna create a new project so click on add a new project and just name this 9 00:01:18,950 --> 00:01:27,680 project whatever you want make me happy happy and this is a text based learning 10 00:01:27,680 --> 00:01:33,400 model so we will select text and in the language will keep English and then we 11 00:01:33,400 --> 00:01:40,950 click create okay so once you have your project make me happy you can click on 12 00:01:40,950 --> 00:01:47,010 this project and then you will have three options first of all is train then 13 00:01:47,010 --> 00:01:51,810 learn and test then make so first of all we will train this model since it's a 14 00:01:51,810 --> 00:01:57,390 learning bit learning model based on text will train it okay so in order to 15 00:01:57,390 --> 00:02:03,870 train you have to add some buckets or training data in order to do that we 16 00:02:03,870 --> 00:02:13,939 have will add a new label and name this label as happy and then we'll create 17 00:02:13,939 --> 00:02:20,659 another label and we'll name it as sad now we can add multiple examples in 18 00:02:20,659 --> 00:02:30,419 these in these buckets that will make our character happy or sad so I can 19 00:02:30,419 --> 00:02:43,830 write ice cream in the happy I can write lunch in the happy I can write holidays 20 00:02:43,830 --> 00:02:50,250 we have all these examples set up we can go back to the project and then we can 21 00:02:50,250 --> 00:02:55,229 learn and test the data we have just given to the machine learning model so 22 00:02:55,229 --> 00:02:59,949 we'll add this train new machine learning model and it will create it 23 00:02:59,949 --> 00:03:07,110 will train the model based on the data given by us and it's gonna take it will 24 00:03:07,110 --> 00:03:14,189 take some time and for that we can wait and it will once it's done okay so once 25 00:03:14,189 --> 00:03:20,490 it's done training the model it will shift this training to trained and we 26 00:03:20,490 --> 00:03:25,289 can proceed from there okay so as you can see the training model has been done 27 00:03:25,289 --> 00:03:31,669 and it's available for the use and it will be deleted by the next day so we 28 00:03:31,669 --> 00:03:36,569 have to use this training model and our examples will be saved in that project 29 00:03:36,569 --> 00:03:40,830 but in order to retrain in order to use this model again after this date we have 30 00:03:40,830 --> 00:03:48,879 to retrain the model okay so we can test it here and if I write idiot it will be 31 00:03:48,879 --> 00:03:59,639 recognized as sad with 85% confidence and if I write here football it will be 32 00:03:59,639 --> 00:04:05,259 recognized as happy so we can test this model and if the model is not up to 33 00:04:05,259 --> 00:04:10,180 scratch up to our limit up to our requirements we can just go back and add 34 00:04:10,180 --> 00:04:14,800 more examples and then retrain this model so that this model is up to our 35 00:04:14,800 --> 00:04:20,699 requirements okay so we can go back to the project and click on make now in 36 00:04:20,699 --> 00:04:24,759 order to in order to use this model we will use scratch 3 but you can use 37 00:04:24,759 --> 00:04:31,779 scratch Python anything you like and we're going to just open scratch 3 okay 38 00:04:31,779 --> 00:04:37,000 so as you can see this is the default scratch 3 interface there is a sprite 39 00:04:37,000 --> 00:04:42,699 and it's a cat we can move this type and first of all we will delete this stripe 40 00:04:42,699 --> 00:04:50,740 and create a new stripe and paint okay so this will be our model will name its 41 00:04:50,740 --> 00:05:00,459 costume one to be okay and it will be our default face and will create a face 42 00:05:00,459 --> 00:05:14,990 like shape and just make sure that it looks like a face so that okay so one 43 00:05:14,990 --> 00:05:21,709 nice bigger one eye smaller it doesn't matter so this is our okay face then we 44 00:05:21,709 --> 00:05:31,300 can duplicate this sprite and change its name to happy and we'll grab a 45 00:05:31,300 --> 00:05:50,379 the brush increase the brush size and create a happy face like this then we 46 00:05:50,379 --> 00:06:01,920 can duplicate it again you can say side and we can just delete this happy face 47 00:06:01,920 --> 00:06:10,980 and add a sad face it's simple okay so now we have three responses of our 48 00:06:10,980 --> 00:06:18,910 character one is okay one is happy and one is sad so we'll go back to code and 49 00:06:20,910 --> 00:06:31,009 we will go back go to control panel and we'll go to events and click on when flag is clicked 50 00:06:31,009 --> 00:06:35,089 there are two flags as you can see this is the go flag and this is the stop flag 51 00:06:35,089 --> 00:06:41,250 okay so it's used to run the program and this one stop is used to stop the program it's quite 52 00:06:44,370 --> 00:06:46,370 self-explanatory 53 00:06:47,230 --> 00:06:49,970 Okay, so then we will use 54 00:06:50,670 --> 00:06:56,470 switch costume to okay, and then we will go to the 55 00:06:57,129 --> 00:07:00,250 control 56 00:07:00,250 --> 00:07:01,990 go to 57 00:07:01,990 --> 00:07:03,990 sensing and ask 58 00:07:04,310 --> 00:07:15,819 So the the character will ask tell me something and it will wait until you tell you until you tell it 59 00:07:16,560 --> 00:07:22,019 Something and the your answer will be saved in this variable known as answers 60 00:07:22,139 --> 00:07:35,720 and then we will go to control and we'll select the if-else condition now if the 61 00:07:35,720 --> 00:07:41,480 thing we said to the character makes it happy and recognized as happy then the 62 00:07:41,480 --> 00:07:45,660 character will change its face to happy and if it's recognized as sad the 63 00:07:45,660 --> 00:07:50,100 character will change its face to sad so it's quite simple so we'll grab this 64 00:07:50,100 --> 00:07:55,199 make me happy will grab this recognize text block from make me happy and when 65 00:07:55,199 --> 00:08:03,899 put it right there and in the text in the text column of this recognize text 66 00:08:03,899 --> 00:08:13,319 will place the answer and will go to operators and if and find equal to okay 67 00:08:13,319 --> 00:08:22,399 and then we'll remove this 50 since we are working with text not with okay so 68 00:08:22,399 --> 00:08:30,540 we'll place this answer into operator and if is if it if what we have written 69 00:08:30,540 --> 00:08:45,279 is recognized as happy then then the whole thing will the character will 70 00:08:45,279 --> 00:08:54,759 change its looks change its costume to happy otherwise it will change its 71 00:08:54,759 --> 00:09:03,289 costume to sad now this is the basic premise of our project and as you can 72 00:09:03,289 --> 00:09:07,389 see the project is already there and there is a happy and sad sign so we can 73 00:09:07,389 --> 00:09:13,750 just click on run project and I'll say that you are an idiot 74 00:09:13,750 --> 00:09:21,519 okay so as you can see that the model is sad 75 00:09:21,679 --> 00:09:22,299 you