﻿1
00:00:00,960 --> 00:00:08,210
‫So in this video we will see how functional EPA can help us build complex neural network architectures.

2
00:00:08,450 --> 00:00:14,730
‫They know we have been building simple architectures that as input goes into foster and layer which

3
00:00:14,730 --> 00:00:21,750
‫goes in two seconds to deliver the output of which goes into the final output layer.

4
00:00:21,840 --> 00:00:31,530
‫Now we're slightly modified this architecture will take this input and merged with the output of it

5
00:00:31,530 --> 00:00:40,740
‫and led to that is will create an additional concatenation layer where the output of the layer too will

6
00:00:40,740 --> 00:00:44,430
‫be there and the input layer will also be added here.

7
00:00:45,570 --> 00:00:53,220
‫So in the contract layer we will have 64 values from different layer two because it has 64 units of

8
00:00:53,220 --> 00:01:00,570
‫neurons and 13 values from the input layer because we have 13 variables.

9
00:01:00,570 --> 00:01:06,600
‫So in the concatenation layer we have seventy seven values which will be imported into our final output

10
00:01:07,110 --> 00:01:10,710
‫layer which has a single layer on.

11
00:01:10,740 --> 00:01:17,060
‫So this kind of architecture is called deep and wide architecture.

12
00:01:18,030 --> 00:01:21,480
‫And this architecture cannot be built using a sequentially be a

13
00:01:25,650 --> 00:01:29,440
‫this is where functionally B is used.

14
00:01:29,610 --> 00:01:31,290
‫Now let's go back to our to do

15
00:01:35,300 --> 00:01:40,940
‫now let's see how we can create that architecture using functional Libya.

16
00:01:41,230 --> 00:01:43,140
‫The first step is same.

17
00:01:43,150 --> 00:01:51,490
‫We have to define the input layer input layer has those 13 variables only so we define the input layer

18
00:01:51,850 --> 00:01:55,950
‫with a shape of 13 variables.

19
00:01:56,380 --> 00:02:03,520
‫The first production layer has only two layers after which will come the concatenation layer.

20
00:02:03,550 --> 00:02:08,300
‫So in the first prediction layer we keep the two hidden layers.

21
00:02:08,590 --> 00:02:13,350
‫We specified that this layer has the input from inputs Splunk.

22
00:02:13,410 --> 00:02:17,160
‫This is the rebel that we define for input layer.

23
00:02:17,410 --> 00:02:22,180
‫Then we have to put the layers after these two hidden layers.

24
00:02:22,180 --> 00:02:27,470
‫We need a concatenation layer in this layer.

25
00:02:27,550 --> 00:02:29,590
‫The output of this

26
00:02:32,860 --> 00:02:39,230
‫first output layer will be concatenated with the initial input layer.

27
00:02:39,980 --> 00:02:41,530
‫To How do we do that.

28
00:02:41,650 --> 00:02:49,820
‫We create this new layer mean output in this we concatenate these two parts.

29
00:02:50,020 --> 00:02:53,690
‫The first part is the prediction func.

30
00:02:53,740 --> 00:03:03,950
‫This includes these three layers and we also add the input func which is this input layer.

31
00:03:04,300 --> 00:03:13,470
‫So these do not become the input layer of this main output and this goes into the last layer which is

32
00:03:13,470 --> 00:03:19,600
‫a dense single unit output layer.

33
00:03:19,780 --> 00:03:23,910
‫I hope you understand the architecture that we have defined here.

34
00:03:24,040 --> 00:03:32,980
‫We have this input layer this is we what we stored in input func then we created predictions func which

35
00:03:32,980 --> 00:03:36,450
‫contained the two layers.

36
00:03:36,880 --> 00:03:47,410
‫Then we create main output structure in which we take the output of this prediction func and the input

37
00:03:47,410 --> 00:03:56,110
‫layer and we concatenated to create a can get layer after which we put a output layer of one single

38
00:03:56,110 --> 00:03:56,470
‫neuron.

39
00:03:58,990 --> 00:04:02,920
‫So all this is done in this part.

40
00:04:03,670 --> 00:04:09,060
‫You can notice here that inputs layer has been used twice.

41
00:04:09,460 --> 00:04:17,770
‫This has been made possible because in functional API we are having each layer as individual part of

42
00:04:17,770 --> 00:04:25,050
‫the structure so we can use those parts many times in the structure.

43
00:04:25,240 --> 00:04:29,550
‫So this input func became a part of the predictions one variable also.

44
00:04:30,310 --> 00:04:37,100
‫And it became part of the main output structure also so next on this

45
00:04:45,010 --> 00:04:52,690
‫and now we will define the architecture of our model using kid US model function in which we will call

46
00:04:52,690 --> 00:05:02,170
‫the inputs are the inputs funk and output is to be taken from the main output structure because this

47
00:05:02,170 --> 00:05:10,060
‫structure has everything it has predictions func also an input Fung also as a concatenated layer in

48
00:05:10,060 --> 00:05:13,030
‫IT structure.

49
00:05:13,210 --> 00:05:25,270
‫When we done this we have model form ready with us is a dysfunctional API model and it has that complex

50
00:05:25,270 --> 00:05:26,990
‫architecture stored in it.

51
00:05:27,310 --> 00:05:35,320
‫Now we can figure this model again we will use outermost properties optimizer lost is messy and the

52
00:05:35,320 --> 00:05:38,800
‫matrix to be recorded is mean absolute error

53
00:05:41,860 --> 00:05:49,720
‫you can see the structure of this model func also using this somebody come on man and on this you can

54
00:05:49,720 --> 00:06:00,190
‫see here that the first layer is the input layer with 13 variables then comes a dense 64 neutron layer

55
00:06:00,700 --> 00:06:09,270
‫which is decoding Layer 1 it is connected to the input layer then comes another dense layer which tells

56
00:06:09,270 --> 00:06:18,430
‫sixty 64 neurons and it is connected to firstly the layer after this we have a concatenation layer in

57
00:06:18,430 --> 00:06:25,210
‫which we can get energy the output of this dense layer with the 13 variables from input.

58
00:06:25,840 --> 00:06:31,420
‫So this concatenation layer is connected to layer 2 and the input layer

59
00:06:35,760 --> 00:06:42,570
‫then we have the last layer which is the output layer which has only one neuron and it is connected

60
00:06:42,570 --> 00:06:46,130
‫to the concatenation.

61
00:06:46,130 --> 00:06:48,830
‫Now we can bring this model using different function

62
00:07:00,510 --> 00:07:07,610
‫and we can compare the best performance of our normal model with a normal deep architecture.

63
00:07:07,620 --> 00:07:13,410
‫What is this complex functional model with wide and deep architecture.

64
00:07:13,420 --> 00:07:15,330
‫So let's run these command

65
00:07:18,700 --> 00:07:25,570
‫to see that the functional model that is the complex model has a test loss of twenty nine whereas a

66
00:07:25,580 --> 00:07:31,010
‫normal model has had a test loss of thirty two.

67
00:07:31,090 --> 00:07:37,240
‫Similarly they mean absolute error for our functional model that is this complex model that we have

68
00:07:37,240 --> 00:07:39,390
‫created is four point three.

69
00:07:39,910 --> 00:07:45,730
‫Whereas the mean absolute better for the simple model that we created earlier was four point forty seven.

70
00:07:46,810 --> 00:07:53,990
‫So there is slight improvement on both of these parameters.

71
00:07:54,130 --> 00:08:01,750
‫Now you have seen how to use functional API to create complex neural network architecture because functional

72
00:08:01,750 --> 00:08:08,640
‫API enables us to use several layers or several structures multiple times.

73
00:08:09,280 --> 00:08:13,490
‫Also in that example this time we solve the immigration problem.

74
00:08:13,810 --> 00:08:19,910
‫The few differences that we have integration problem is instead of using accuracy.

75
00:08:19,990 --> 00:08:21,670
‫We were using MSE

76
00:08:24,790 --> 00:08:31,440
‫for the lost function and the metric we were observing integration problem was mean absolute.

77
00:08:31,620 --> 00:08:43,000
‫Edit in the architecture of integration problem the output layer has no activation function.

78
00:08:43,570 --> 00:08:48,400
‫So with this we conclude our lecture on functional API and regression problems.

