‫Hello everyone.
‫Welcome back.
‫In this lecture we are going to learn about two concepts.
‫One is how to build a neural network for regression problems.
‫And the second is how to do it using functional EPA.
‫They know we have been using sequential EPA and the selective utility how to use functionally being
‫functionally being is basically used for defining complex models such as Marty input on multi output
‫models or models which I've shared led.
‫So first really made a normal model using functional EPA which could also be done using sequentially.
‫But then we will create a complex neural network structure which can only be handled by a functional
‫EPA.
‫Also we'll be solving a regression problem which means our output variable is a continuous variable.
‫That is it is not due to one type it can have any value without any boundaries.
‫For this problem will be using Boston housing data say it is a very standard data set in which we have
‫14 variables
‫13 of the predictive variables and 14.
‫One is the value of the house basically using the values of 13 predictor variables.
‫We want to predict the value of house.
‫This is also an in big data say hey not give us liberty so we can imported using this line
‫if we want to know more about the most housing data say you can visit this link it has details of only
‫13 predictive variables the predicted variables include variables like crime rate number of hotel rooms
‫etc. You can see that Boston housing data set is now imported you can look at this by clicking on it.
‫The Boston housing data center has two parts green part and the best part.
‫Within brain we have four hundred for observations of thirteen predictive variables that is in the ex
‫and we have the labels that is the value of holes to we predicted invite in test.
‫We have a set of hundred two observations.
‫Again taking predictive variables and invite.
‫We have the opportunity
‫now as we did earlier we'll be importing the training part into training data and brain labels variable
‫and testing part of this dataset into best data and best labeled variable.
‫Next run these two lines of code
‫and now we have these new variables test data and bring data.
‫These are the predictor part of the data and test levels and grade levels.
‫These are the output part of the
‫next guns preparing the data.
‫And one of the important steps that we saw earlier was normalizing the data in the previous problem.
‫We had only pixel data which was homogeneous.
‫So we simply divided it by two to five to get the skilled version of that data.
‫But now we have heterogeneous data that is all these 13 variables representing 13 different things.
‫It is not easy to scale.
‫So it's kind of meta
‫to normalize this data.
‫We used this function sked this scale function automatically finds out the meaning of every variable
‫and the standard deviation of every variable.
‫And it uses that formula that I showed you earlier.
‫It's a proxy meaning from each value and divides that value by the standard deviation.
‫So simply using the scale function you can normalize our training data to normalize the test data.
‫We do not use the mean and standard deviation of vectors data we use to mean and standard deviation
‫of training data.
‫The concept is we know only the training part of the data.
‫Our model does not know any other detail of the word.
‫So we have only the training.
‫But from that we find out the mean and standard deviation of each variable.
‫We assume that this standard deviation and mean of each variable applies to the entire dataset of the
‫world.
‫So using those mean and standard deviations you'll be scaling our best data.
‫Also
‫so in this line we will scale our training data using this scale function and this line we will find
‫out.
‫The column means indicating data and we'll be storing that information in this variable called mean
‫stream
‫in this line.
‫We are finding out the standard deviation of these variables in training data and storing them in the
‫variable called call standards.
‫Now using the means of training data and standard deviations we use this scale function.
‫It is the same scale function but here we are specifying the mean and the standard deviation to be used
‫for scaling this test data.
‫Now our data is ready.
‫Our training data is normalized.
‫Our test data is also normalized.
‫Any new data on which you want to predict the outcome of the model.
‫You have to scale it again using this scale function
‫now comes the part when we define neural network.
‫This time we'll be using functionally be functionally B.A. has two different parts.
‫One is the input and one is output inputs.
‫Early model about all the variables that we are inputting in the model.
‫So basically in the input layer we clearly model that we have an input layer of shape is equal to number
‫of variables.
‫I could have written 13 here because I know that the number of variables are 13 in this particular dataset
‫but even if you change your train data you need not update your model.
‫If you divided like this if you died this way This means that you want to get this second dimension
‫of declining data.
‫So basically training data has these two dimensions.
‫It has 400 photos and 13 columns.
‫We want this dimension because this represents a number of variables in this training data.
‫So that is what we do.
‫We have written to here.
‫So using this even if you change your brain data to any other dataset you'd need not update your shape
‫for this neural network it will automatically get updated.
‫The second part is the output layer.
‫And this layer we first include the input layer to this outwardly which is the same as the input layer
‫that we created earlier.
‫This is important because this creates the connection between the input and output layer if we do not
‫specify that this output layer has this input layer.
‫Then there will be no connection between these two.
‫So in the output layer the first thing is always the input layer that it will take.
‫Then comes the hidden layers which is similar to the way that we specify in these sequential EPA too.
‫In this scenario we are using to the layers both with sixty four neurons the activation function for
‫both of these is real need.
‫Lastly that is the output layer has only one neuron and it has no activation function because it is
‫a regression problem.
‫So let's run these two lines of code.
‫This creates one input into input.
‫Now this will create another output center which is predictions
‫9 functionally we create the model using get us model function.
‫It takes in two parameters.
‫One is the inputs and 1 is output input.
‫We have a name as importantly and the output has been named as predictions.
‫So input particular input output is equal to predictions.
‫And this defines the models architecture.
‫So our models architecture is we have 13 variables which are coming in as input in the first event.
‫We have 64 neurons in the second layer.
‫We have another 64 neurons and in the output layer we have one output neuron.
‫So when I done this a model is created and its architecture is specified.
‫Now we configured this model in configuration we specify to optimize it.
‫We can use a duty Optimus probe on whichever you like lost function for immigration problems is a messy
‫mean square the matrix is not a necessity however we have used mean absolute error
‫to win and then model is configured.
‫Now we train our model using different function.
‫Again we input the training data training levels epochs Andy Betsy's
‫you can see that the model is running for 30 bucks and a loss that is the MDC is steadily decreasing.
‫I mean absolute but it is also because the model has run for 30 bucks.
‫We can check the performance of this model on our test it does is similar to what we have done when
‫we were using sequentially B used to evaluate function and importantly test time best labeled and do
‫it to list on the test loss and test absolute error.
‫We can run these two commands and we can see that the test lost is thirty two point five six and this
‫absolute edit is four point forty eight.
‫So in this video we saw how to use functional EPA to be another one more on this model could have been
‫built using sequential EPA as well.
‫And in fact it would have been easier to use sequentially being hit but in the next lecture we will
‫see if we have a complex neural network architecture how functionally B helps us in building that scene
‫in the next one.