1 00:00:01,340 --> 00:00:09,260 In the last couple of videos, we learn how to create new little network will get US sequential EPA, 2 00:00:10,760 --> 00:00:16,790 the sequential EPA was quite easy to use, but it has some limitation. 3 00:00:19,010 --> 00:00:26,840 With sequential EPA, you can only create neural network with simply sequential architecture. 4 00:00:28,130 --> 00:00:37,070 You cannot create complex topologies like this where you have multiple inputs or multiple outputs. 5 00:00:38,180 --> 00:00:40,910 For that, you have to use functional LaPier. 6 00:00:42,350 --> 00:00:43,370 And functionally functional. 7 00:00:44,150 --> 00:00:48,530 We create each of these layers in the form of functions. 8 00:00:49,270 --> 00:00:52,520 Or you can say a building block off your neural network. 9 00:00:53,330 --> 00:00:57,930 And you can use this functions to create a complex structure. 10 00:00:58,250 --> 00:01:01,520 By joining them according to your structure need. 11 00:01:03,600 --> 00:01:12,230 Before going into details, let's first building the model that we created in our last lecture just 12 00:01:12,230 --> 00:01:12,750 very well. 13 00:01:12,960 --> 00:01:14,150 And you're more than name. 14 00:01:14,700 --> 00:01:19,100 And then you also need to clear the session off your get us. 15 00:01:19,740 --> 00:01:23,700 This will free up the resources for our next model training. 16 00:01:25,680 --> 00:01:27,710 So just start get us back. 17 00:01:28,050 --> 00:01:29,400 Not clear session. 18 00:01:32,470 --> 00:01:37,350 Then this, too, now virally to create and create our next modern. 19 00:01:39,780 --> 00:01:43,020 For functional EPA, we will be using this example. 20 00:01:44,540 --> 00:01:53,750 This kind of neural network is known as wide and deep neural network deep because our input is going 21 00:01:53,750 --> 00:02:01,490 through two layer of soft, dense, hidden layer and vital because of what input is directly going for 22 00:02:01,580 --> 00:02:02,630 output as well. 23 00:02:04,040 --> 00:02:13,240 So along with the output of this hidden layers, it also connect all parts of our input that include 24 00:02:13,260 --> 00:02:14,360 to the output layer. 25 00:02:17,050 --> 00:02:24,740 This linkage, which I have my best wide, is not possible when we are using sequentially pure. 26 00:02:27,670 --> 00:02:35,050 The advantage of this architecture is that it makes possible foreign neural network to learn both the 27 00:02:35,050 --> 00:02:36,030 deep patterns. 28 00:02:36,490 --> 00:02:42,490 But this deep linkage and the simple rules by this wide linkage. 29 00:02:45,040 --> 00:02:53,710 In our regular MLP, more than all the data flows through this full stacks of dense layers and thus 30 00:02:54,010 --> 00:03:00,460 some simple patterns in the data may end up being distorted by the sequence of this transformation. 31 00:03:03,800 --> 00:03:07,300 So now let's create this lid's one by one. 32 00:03:08,870 --> 00:03:14,330 We will be using the same data set as we use for our last lecture. 33 00:03:18,000 --> 00:03:20,780 First, we need to clear it up and put layer. 34 00:03:21,270 --> 00:03:30,510 We are calling it input and we are creating it would get us not leers, not input, and then we have 35 00:03:30,510 --> 00:03:31,490 to provide the ship. 36 00:03:32,250 --> 00:03:32,940 We can either. 37 00:03:32,950 --> 00:03:33,360 Right. 38 00:03:34,620 --> 00:03:40,830 Just it in decades because we have eight independent variables or we can write it in this way. 39 00:03:41,130 --> 00:03:45,630 Extreme dot ship and then the first and so on attribute. 40 00:03:46,230 --> 00:03:47,760 So this is our input layer. 41 00:03:48,480 --> 00:03:51,700 We will create this kind of list. 42 00:03:51,930 --> 00:03:55,680 And then we will connect these lists accordingly. 43 00:03:56,760 --> 00:04:04,200 So next we create a dense layer with 30 neurons using RELU activation. 44 00:04:05,970 --> 00:04:07,770 And you can also notice that. 45 00:04:08,790 --> 00:04:12,210 We are calling this input player like a function. 46 00:04:12,990 --> 00:04:16,020 So this input layer is the input for this head on layer one. 47 00:04:16,620 --> 00:04:18,600 And we are calling it like a function. 48 00:04:19,110 --> 00:04:22,250 And that's what we call it, functional EPA. 49 00:04:22,680 --> 00:04:31,020 We create this kind of layers and we use these layers as functions for our next players. 50 00:04:33,330 --> 00:04:37,040 So we have connected our input layer of what he'd done to. 51 00:04:39,560 --> 00:04:41,670 Now we create our second hidden lair. 52 00:04:43,700 --> 00:04:50,690 Again, we are using cameras, dot layers, dot dense, and we are creating it with 13 neurons and activation 53 00:04:50,690 --> 00:04:51,440 is a loop. 54 00:04:52,280 --> 00:04:57,380 And now for this hidden layer to our input should be the layer one. 55 00:04:57,710 --> 00:05:01,250 So we are passing our hidden layer one as a function here. 56 00:05:02,990 --> 00:05:05,480 Now, the next step is this. 57 00:05:05,900 --> 00:05:09,410 Here we want the output of this hidden layer, too. 58 00:05:10,130 --> 00:05:13,590 And also we want all lowered inputs variable here. 59 00:05:14,270 --> 00:05:15,560 You can see this linkage. 60 00:05:15,770 --> 00:05:19,330 We want these two to go into this contact layer. 61 00:05:20,860 --> 00:05:26,560 Concat land is just muddying the output of the left and all the inputs. 62 00:05:29,760 --> 00:05:37,240 So we can ride this Laria as concat and then we'll use guitars, dot, Lear, dot concat. 63 00:05:39,570 --> 00:05:43,610 And we are passing the list off our put off her or two. 64 00:05:44,360 --> 00:05:45,430 And put Claire. 65 00:05:47,210 --> 00:05:55,490 If we wanted to put off her down layer one as what we can right then layer one here and it will add 66 00:05:55,580 --> 00:06:04,190 a linkage like this also, so you can see you can customize all this linkages very easily using a functional 67 00:06:04,190 --> 00:06:04,670 LaPier. 68 00:06:05,920 --> 00:06:12,720 Not next step is to create our output layer, our output should get input from the concrete layer. 69 00:06:13,570 --> 00:06:15,280 And this should be a single neuron. 70 00:06:15,850 --> 00:06:21,260 So we are creating output equal to give us not lietz, not Bence. 71 00:06:22,060 --> 00:06:29,340 And then a single neuron without any activation function and input as the output of contact layer. 72 00:06:29,680 --> 00:06:32,390 So we are passing concrete layer as a function here. 73 00:06:34,470 --> 00:06:36,470 Now, we have created all the layers. 74 00:06:37,410 --> 00:06:41,700 The next step is to combine all this layers and create a modern. 75 00:06:44,100 --> 00:06:49,910 So we are creating a model object and then we are calling it our start model start model. 76 00:06:50,460 --> 00:06:56,100 And here we are mentioning what we want as our input and what we want as our output. 77 00:06:56,730 --> 00:07:01,090 So what input is this first input layer and our output? 78 00:07:01,320 --> 00:07:02,960 Is this last output layer? 79 00:07:04,710 --> 00:07:12,800 Think sequentially appear we first create a model and then we create each layer, layer by layer, but 80 00:07:12,830 --> 00:07:13,910 then functionally appear. 81 00:07:15,170 --> 00:07:21,350 We create this layers and then we join this layers to create this whole network. 82 00:07:22,750 --> 00:07:29,680 Just run this now again, just to look at the structure of the model that you have created. 83 00:07:29,950 --> 00:07:31,750 You can call not somebody. 84 00:07:33,070 --> 00:07:34,850 So what object name is Morton? 85 00:07:35,380 --> 00:07:36,780 And we are calling somebody. 86 00:07:38,650 --> 00:07:40,960 You run this, you will get all the details. 87 00:07:41,440 --> 00:07:45,030 First, we have input layer with eight input variables. 88 00:07:45,940 --> 00:07:50,530 Then we have a dense layer with 30 neurons than we ever were a second. 89 00:07:50,650 --> 00:07:53,140 Then slier again with 13 neurons. 90 00:07:54,430 --> 00:08:01,130 Then we have a concrete layer where we are contacting the input of the second non-slip. 91 00:08:01,600 --> 00:08:02,890 And our input layer. 92 00:08:03,790 --> 00:08:08,320 So you can see we're 30 less a so her beaird neurons here. 93 00:08:10,300 --> 00:08:15,110 And then we have our output that we have on leveland neuron. 94 00:08:16,540 --> 00:08:18,480 Now the next step is to compile. 95 00:08:19,480 --> 00:08:29,260 And just as in our previous lecture, we will be using mini skirt to edit as lost function as Judy with 96 00:08:29,260 --> 00:08:39,580 learning rate of zero point zero zero one as our optimizer and Emmi or mean absolute edit as our additional 97 00:08:39,760 --> 00:08:40,870 metrics to calculate. 98 00:08:42,760 --> 00:08:43,450 From this. 99 00:08:45,650 --> 00:08:51,410 Now, fitting the model, the same will just say more than Lord fit for weight training. 100 00:08:51,550 --> 00:08:54,270 Does it provide a bit of epoch values? 101 00:08:55,290 --> 00:09:02,350 And then the relevation dare to say, since last time we ran that tradition, more than 440 books. 102 00:09:04,080 --> 00:09:06,240 So changing it for four equals. 103 00:09:07,770 --> 00:09:11,730 So that's just been more than. 104 00:09:16,460 --> 00:09:22,910 Again, you will see the lost functions, whether the loss and the value of my kid that you have up 105 00:09:23,090 --> 00:09:23,360 here. 106 00:09:26,460 --> 00:09:27,640 You can see the lost value. 107 00:09:27,660 --> 00:09:30,510 We are getting on our training set at zero point three six. 108 00:09:30,540 --> 00:09:35,410 This is Tamasi value and the validation loss is zero point three six three eight. 109 00:09:37,070 --> 00:09:40,780 Let's calculate the value on our test data. 110 00:09:44,000 --> 00:09:52,020 You can see the lost value here is zero point three zero six four are near in our last case. 111 00:09:56,560 --> 00:10:00,060 I guess we were getting law says zero point two five one five. 112 00:10:01,630 --> 00:10:10,350 So this model is not performing that good, but in some situations, this kind of deep and wide net 113 00:10:10,380 --> 00:10:13,450 cut but falls better than a normal MLP. 114 00:10:13,510 --> 00:10:14,170 Martin's. 115 00:10:15,930 --> 00:10:21,640 In this case of a normal MLP model, is platforming better than this wide and deep net for. 116 00:10:23,310 --> 00:10:26,390 Again, you have all the parameters available to you. 117 00:10:26,610 --> 00:10:33,090 So if you just read model underscored a student history, you will get all the lowest values. 118 00:10:34,850 --> 00:10:43,640 And the Emmy, you and Lou, that we got during their training, and you can also load this on the just 119 00:10:43,640 --> 00:10:44,840 like we did earlier. 120 00:10:47,460 --> 00:10:56,370 So the important thing here is that what reputation, loss or validation and me value is still decreasing. 121 00:10:56,880 --> 00:11:02,280 So there is a scope of further improvement in the accuracy of our model. 122 00:11:03,390 --> 00:11:05,280 So let's just run this. 123 00:11:05,470 --> 00:11:08,550 More than 440 more epoch as well. 124 00:11:20,320 --> 00:11:22,540 Now, let's conclude the. 125 00:11:23,420 --> 00:11:24,840 Yes, well, use as one. 126 00:11:27,840 --> 00:11:32,730 You can see now the laws has decreased to zero point six. 127 00:11:33,630 --> 00:11:36,270 Earlier, we will getting around zero point three. 128 00:11:37,260 --> 00:11:40,890 Now we have zero point two six as a loss when you. 129 00:11:42,980 --> 00:11:50,190 You can also put out this graph again to see whether the model of converts this time or not. 130 00:11:54,220 --> 00:12:00,250 You can see this is almost so straight line, so we can see that model has converged. 131 00:12:00,940 --> 00:12:07,940 And the best value for the word modern and the masc value what our model is. 132 00:12:08,470 --> 00:12:10,880 Zero one two six one on the test site. 133 00:12:13,030 --> 00:12:18,730 This is somewhat similar to the accuracy we bought earlier with our normal MLP model. 134 00:12:20,050 --> 00:12:20,210 But. 135 00:12:21,100 --> 00:12:27,010 I would say that our normal MLP be who was performing better than this deep and wide net for. 136 00:12:29,170 --> 00:12:31,770 So that's all for this lecture in the next lecture. 137 00:12:31,800 --> 00:12:39,210 We will see how to say what what model and how to save check points at the end of each epochs. 138 00:12:39,840 --> 00:12:40,260 Thank you.