In the last couple of videos, we learn how to create new little network will get US sequential EPA,
the sequential EPA was quite easy to use, but it has some limitation.
With sequential EPA, you can only create neural network with simply sequential architecture.
You cannot create complex topologies like this where you have multiple inputs or multiple outputs.
For that, you have to use functional LaPier.
And functionally functional.
We create each of these layers in the form of functions.
Or you can say a building block off your neural network.
And you can use this functions to create a complex structure.
By joining them according to your structure need.
Before going into details, let's first building the model that we created in our last lecture just
very well.
And you're more than name.
And then you also need to clear the session off your get us.
This will free up the resources for our next model training.
So just start get us back.
Not clear session.
Then this, too, now virally to create and create our next modern.
For functional EPA, we will be using this example.
This kind of neural network is known as wide and deep neural network deep because our input is going
through two layer of soft, dense, hidden layer and vital because of what input is directly going for
output as well.
So along with the output of this hidden layers, it also connect all parts of our input that include
to the output layer.
This linkage, which I have my best wide, is not possible when we are using sequentially pure.
The advantage of this architecture is that it makes possible foreign neural network to learn both the
deep patterns.
But this deep linkage and the simple rules by this wide linkage.
In our regular MLP, more than all the data flows through this full stacks of dense layers and thus
some simple patterns in the data may end up being distorted by the sequence of this transformation.
So now let's create this lid's one by one.
We will be using the same data set as we use for our last lecture.
First, we need to clear it up and put layer.
We are calling it input and we are creating it would get us not leers, not input, and then we have
to provide the ship.
We can either.
Right.
Just it in decades because we have eight independent variables or we can write it in this way.
Extreme dot ship and then the first and so on attribute.
So this is our input layer.
We will create this kind of list.
And then we will connect these lists accordingly.
So next we create a dense layer with 30 neurons using RELU activation.
And you can also notice that.
We are calling this input player like a function.
So this input layer is the input for this head on layer one.
And we are calling it like a function.
And that's what we call it, functional EPA.
We create this kind of layers and we use these layers as functions for our next players.
So we have connected our input layer of what he'd done to.
Now we create our second hidden lair.
Again, we are using cameras, dot layers, dot dense, and we are creating it with 13 neurons and activation
is a loop.
And now for this hidden layer to our input should be the layer one.
So we are passing our hidden layer one as a function here.
Now, the next step is this.
Here we want the output of this hidden layer, too.
And also we want all lowered inputs variable here.
You can see this linkage.
We want these two to go into this contact layer.
Concat land is just muddying the output of the left and all the inputs.
So we can ride this Laria as concat and then we'll use guitars, dot, Lear, dot concat.
And we are passing the list off our put off her or two.
And put Claire.
If we wanted to put off her down layer one as what we can right then layer one here and it will add
a linkage like this also, so you can see you can customize all this linkages very easily using a functional
LaPier.
Not next step is to create our output layer, our output should get input from the concrete layer.
And this should be a single neuron.
So we are creating output equal to give us not lietz, not Bence.
And then a single neuron without any activation function and input as the output of contact layer.
So we are passing concrete layer as a function here.
Now, we have created all the layers.
The next step is to combine all this layers and create a modern.
So we are creating a model object and then we are calling it our start model start model.
And here we are mentioning what we want as our input and what we want as our output.
So what input is this first input layer and our output?
Is this last output layer?
Think sequentially appear we first create a model and then we create each layer, layer by layer, but
then functionally appear.
We create this layers and then we join this layers to create this whole network.
Just run this now again, just to look at the structure of the model that you have created.
You can call not somebody.
So what object name is Morton?
And we are calling somebody.
You run this, you will get all the details.
First, we have input layer with eight input variables.
Then we have a dense layer with 30 neurons than we ever were a second.
Then slier again with 13 neurons.
Then we have a concrete layer where we are contacting the input of the second non-slip.
And our input layer.
So you can see we're 30 less a so her beaird neurons here.
And then we have our output that we have on leveland neuron.
Now the next step is to compile.
And just as in our previous lecture, we will be using mini skirt to edit as lost function as Judy with
learning rate of zero point zero zero one as our optimizer and Emmi or mean absolute edit as our additional
metrics to calculate.
From this.
Now, fitting the model, the same will just say more than Lord fit for weight training.
Does it provide a bit of epoch values?
And then the relevation dare to say, since last time we ran that tradition, more than 440 books.
So changing it for four equals.
So that's just been more than.
Again, you will see the lost functions, whether the loss and the value of my kid that you have up
here.
You can see the lost value.
We are getting on our training set at zero point three six.
This is Tamasi value and the validation loss is zero point three six three eight.
Let's calculate the value on our test data.
You can see the lost value here is zero point three zero six four are near in our last case.
I guess we were getting law says zero point two five one five.
So this model is not performing that good, but in some situations, this kind of deep and wide net
cut but falls better than a normal MLP.
Martin's.
In this case of a normal MLP model, is platforming better than this wide and deep net for.
Again, you have all the parameters available to you.
So if you just read model underscored a student history, you will get all the lowest values.
And the Emmy, you and Lou, that we got during their training, and you can also load this on the just
like we did earlier.
So the important thing here is that what reputation, loss or validation and me value is still decreasing.
So there is a scope of further improvement in the accuracy of our model.
So let's just run this.
More than 440 more epoch as well.
Now, let's conclude the.
Yes, well, use as one.
You can see now the laws has decreased to zero point six.
Earlier, we will getting around zero point three.
Now we have zero point two six as a loss when you.
You can also put out this graph again to see whether the model of converts this time or not.
You can see this is almost so straight line, so we can see that model has converged.
And the best value for the word modern and the masc value what our model is.
Zero one two six one on the test site.
This is somewhat similar to the accuracy we bought earlier with our normal MLP model.
But.
I would say that our normal MLP be who was performing better than this deep and wide net for.
So that's all for this lecture in the next lecture.
We will see how to say what what model and how to save check points at the end of each epochs.
Thank you.