High in this session, we will be working with neural network implementation, so let us begin with
the food.
So here we have the import statement.
So first of all, we will import Binder's as we can also import numpties and be.
And after doing the board, we will work on the details of this particular dataset, which I have selected
is a data set of spying, and this will basically help us find out the details of who should be having
our lower back pain and who should not be having a lower back pain.
So it has data related to the same.
So we will import data and read the data by using the CSP function.
And the data underscores fine is the data frame which has been activated.
Now let us have a look at the data set.
So this data set has three hundred and ten rows and 14 columns.
Now we don't really know the levels of the columns, so these it has around 12 columns.
Apart from that, it has class attribute, which shows values like if it is abnormal or normal, and
there is a last column which is unnamed, which does not have much details about that.
And it is saying that the prediction is done by using binary classification.
So now let us go for the.
So from this fine dataset, we will remove the following one and unnamed column 13.
So this column one and column named 13 will be removed.
Now we have data from underscored spine.
So this will have all the details from column two to column number 12, along with the class attribute,
which is declasse Liebl, actually, which we want to predict.
So here we want to predict if the spine is normal or abnormal.
So the first thing that we will have to do is we will have to convert this into a dummy variable where
we will change normal and abnormal to zero and one.
So all the data which we have is numeric in nature.
So all we will have to identify here is if there is any specific correlation is present in this particular
dataset.
So for that, again, we have already stated what other methods you can apply.
You can use find us profiling.
You can use VIFF calculator, you can use correlation matrix.
So any of those could be used for the if you want to use you can use feature importance from random
forest.
So there are well established methods which we have discussed.
So you can use any of those methods which you want.
So now we have this data set and now it has 12 columns.
Now these are the headers which we have.
So we already have the headers for these data.
So we will apply the headers by doing the underscores my DOT columns.
So and then we will assign the header stored until we get the header values.
So it does pelvic incidents, pelvic tilt, then different films related to biology are present.
And finally, the class which you want to predict.
The next thing which we will be doing is we will be checking if there is any data which is not present
or is not.
So we are taking the data from the phone records.
Fine.
We are checking if there are any rules where the spine is not.
And we are checking if there is any of these in axis equal, the one that doesn't any column which has
null value in it and we are getting the go offered so it gives out.
So there are no null values in this particular dataset.
So now we will check the data types so you can easily see that all the data is flawed, so we need not
do anything about it.
The only thing which we need to take care of is the class.
So we will import preprocessing and apply preprocessing dot label in order and then transform the class
column here.
So we can see the top then samples, so we are doing the sample and getting the values out of it.
So this is one function which will allow us to take the values in a sample form.
So here you can see the glasses have me created and you can see the glasses which have been generated
here.
So the class values have changed to one and zero.
Now, let us find out the correlation value so we can simply find out the correlation using dot seawater
for correlation.
So these are the values for correlation and we can find out the correlation values.
So let us plot these correlation values.
So here you can see there are no light colored correlation values, which is fine.
So we don't have any highly correlated values.
If we look at the like that and so here we can see there are certain.
Values which are going towards minus four, which is, again, not a critical value.
So we are going to go here.
We don't have any highly correlated problems present so we can go ahead without deleting any particular
columns.
So we are importing the three best split now.
So we have to get the X and Y data frame separated.
So X date of frame will be separated by the ifs fine from the class column and invite.
We will keep only the class column.
Now we will check the data again, so we have all the columns except for the last column, so let us
check that if it is fine so you can see that the glass column is missing from here.
So it is perfectly fine.
And in Divided of the Glass column, should be the only one percent which is rightly shown here.
Now we will split the data.
So we split the data using the split.
So we provide the X and Y data frame and deepest slice, which we want.
We want that size to be on the zero point too, that this 20 percent, because we don't have enough
rules of data.
So we would like to have a majority share of our data for testing.
Now, one thing to note here is, let's see, we have a very large amount of data.
Let's see if I have an.
One hundred thousand rows of data then I could have guessed even a very low amount of data for this,
but maybe 10 percent or maybe five percent because I want to bring my model 50.
So that is the target.
If the data size is very huge, we can reduce the size of testing data.
And again, if the testing if the data size is very small.
Then again, we will like to reduce the size of our testing data and keep more of the data for training
focus, if the size is medium for the data said, you can keep around a ratio of 70, 30 or seventy
five.
Twenty five.
That is completely up to you.
So just make sure that you have enough data points to to train, also enough data points to test it
also.
So we split the data, so after splitting, we get extreme X test by train and rightest.
So now we will import the multileveled Perceptron now this multiplayer Perceptron is nothing but the
neural network which we will be using.
Is it given the name MLT because it is simply multilayered neural network.
So it is just another name which is present for multilayered neural network, which is multilayered
Perceptron.
So Perceptron is of neural network within which all nodes are connected with each other.
That is why we are considering this as a multilayered Perceptron.
If we were supposed to do some changes, which will be a part of a higher topic under the word opaque,
so we can take that up little and like those could be studied later, but that is out of the scope of
this course.
So for now, what you can understand this is that MLP, that this multimeter percent is nothing but
a fully connected neural network.
So in Escalon Metric, we are the driving, the musical and from selection, we are picking up the randomizer
TV because they just want to try.
Only a few combinations.
You.
So I'm giving the barometer's so the parameters are great if I want to have different variants in my
learning rate.
So these are if I want the learning to be constant, if I want my learning, they be changing.
And if I want by learning to be actually adaptive to how my learning is going.
So I choose adaptive for that.
These are the hidden layer sizes.
What this means is this is a couple which I'm giving it.
So this means that the forest here, the left will have five nodes, the next Hitler will have their
nodes and the next to the left will have five.
So how will this look like so let me show this to you.
So it will look something like this.
Apologies for the drawing.
It will have 12 in less than 12 input points, one output point, then five nodes in the layer one,
then nodes in the layer two and five nodes in the layer three.
And all of these points, all of these points will be connected to these points.
The all of layer one point will be connected with the layer to point.
All the layer to points will be connected with the layer three points and so on.
Now, let us go further with the training.
So these are different features, so we have four values.
So these are different values which we will be having.
This is the activation functions which we are having logistic bendu and then we adjust to creating the
object of my dealer, Perceptron, and creating an object of randomizer TV in which we have provided
the model name, the number of models we want to select out of these then the cross-validation which
we want to have.
I'm the scoring method, which you want to use, then we have done random search dog search, so it
is fitting five candidates out of all the combinations that are present here.
You can run a grid search also so that you get an extensive result, a better result out of this.
So here you can see these are the results which I have got.
Let me get the best estimate.
So my best estimate has the activation value logistic and for value zero point one that says auto B.W.
one zero point nine.
And these are different values.
So for this, I will simply read the report.
So the best model has accuracy level of zero point eight seven six.
And this what is Elby If Jesus is adaptive, Hitler is 21, Martin, and Alpha value is zero point one,
activation for action is logistic.
So you can see that this is the best performing model and the worst one is zero point six nine percentage
atkins', so now I will simply get the details with the model again and I will make the predictions
and show you the predictions in the dorms of crosstab.
So this is the cross matrix for this, so you can see.
These are the confusion matrix deal, so you can see that Ford predicted values and actual value one.
This is forward and these are different values which have been theater.
Now let us have a look at the classification report.
So here the precision for a precision is zero point nine legal is zero point seventy three point seven
five.
And if one score is zero point eight four point sixty.
Now, as you can see, the precision value is zero point nine zero and for one it is zero point five
five.
So it is biased towards one zero plus zero.
So you can change the model and train it again so that you can get a better result.
So for that, probably you can use Garozzo TV so that obtain better results from it.
So this is just an implementation which is not really fine tuned and in case of neural networks.
You will have to try different combinations of different layers and see how it works out for you.
So that is the process which we have for neural networks.
You will have to try different combinations and find out the one which works the best.
Thank you.