All right, everyone.
So next step is applying this random forest machine learning algorithm on the top of a message column
or I will say our training data, say XStream and likely.
All right.
So here we are dealing with just tax data only, and we just cannot prove all those actual data directly
on a machine learning algorithm.
V, how to convert some sort of encoding which will convert all those textual data into some sort of
numbers.
Now, to do that, there are a number of Mattos are available like a bag of four Smardon what I would
say DFI RDF model and some of the deep learning based advance models like a vote to work for a global
actors.
So all those techniques eventually try to convert all those textual data into kinds of number which
will try to preserve all those semantic relationship exist between the data.
The deep learning mis model of Bisley works much better with accuracy.
But we'll go with the one hand coding technique which will convert all your text data into kind of D.F.
idea factor.
That is nothing but a down frequency.
Hannah, inverse documents frequency.
So multiplication of most of this will give you some number and gives you some score the presence of
some particular word in a document.
So you can consider every single record here as a kind of document.
So what do you do?
Let me first import those PEF ideas.
So from.
SBA loan.
Not feature extraction.
Let's import.
So feature sticks and inside Taito.
So we to go like a tax model and it will be at D.F. Ideas, rectories it.
All right.
So that is the one input.
Another one is we are going to apply this addendum forest already.
So that is a part of our Skillern and Simbel Martin.
And let me import
random forest.
Classified.
So first will apply this DFI leaf.
And then random forest classified.
So that is a kind of very much pipelined process.
So what we'll do applying this, both things individually, we can create one pipeline object.
So that is also part of this Aspelin pipeline.
We help import this.
Pipeline.
All right, now, instead of creating this two object, we will create a pipeline object.
And instead the pipeline object, we will just pass most of this object, PEF, IDF, recognize it and
then the forest classify it.
So let me make pipeline object.
And here we will pass it as a list.
This two objects, DFI, Dave, vectorized object and a random forest classified object so we can pass
both of them as like couples.
So it will be a let's give the name like the IDF and corresponding its object.
Next is.
Obviously, a classic fire that is nothing but a random forest classified object.
Now this number is classified.
It contains a lot of hyper parameter.
So you can see you can see here.
There are a lot of Hyperdynamics to exist, so if you want to improve this model, you can do this hyper
parameter.
So let's just make it some hyper parameters, like let's say and in this estimate, stimulus.
So lean forward to Ray Lewis and Ray.
Let just make it even handed on.
So that we be an estimate.
Let's just make it four timing, let's say 10.
And let me assign it to classify it as an object.
And let just treat our input training data, because one object got created, you need to train.
And for training, there is a uniform sets of EPA that are available.
Now, this has scale and library.
So that will be a fit function.
So here we are going to pass.
Explain Tanah Lightering.
All right, let me execute it.
And that training process will start and you can see for creating.
Ten different estimates are I would say that is a 10 different.
This is in 3D will create.
It has immediately given us the results so we can even go with a let's say and date also.
And let me defined as classified once again, let just fit it once more.
All right, so immediately we've got the result.
That means our training is finished.
Let's try to evaluate what model that how good our model is.
So model, it's created.
Our training process is what we need to use this classifier object.
And we are going to use this Braddick matter.
So prediction, we are going to apply on packs and escort testing.
That means the input they stay w will pass it and it will give us some kind of prediction that our model
has predicted this values.
Let me executive.
And if you're just this by and this court test and why in the school, right.
Side by side comparison, you would be able to see.
All right.
So first, it has displayed this vibrate and then it has displayed this light prediction.
So first Hispan, then we have a spam, then spam.
All right.
So analytically, how we can compare both of this.
Is a.
And to do those thing, there is a one definite matricide available to get the accuracy behind your
classification problem.
So one is like a full detailed classification record.
So it will be hard if you just want to know about the accuracy score or if you want to know about the
one specific measurement criteria later.
Confusing matrix.
So let's try to find all of them.
So from Haski line.
Not metrics.
We are going to import.
Classification Report 101 is accuracy scored.
And one more is confusing matrix right now.
Whatever it predicted data in our test data, we will be supplying and we'll try to find all those main
criteria, how good our model is.
So one is we can use like a accuracy score.
So first, what argument you need to pass like a virus.
That means your ground level and next is that you are protected.
So that will be a white test that is able to truly win and wipe predicted.
Will be it predictive, is it?
And if you execute it.
You'll be able to see almost ninety four point sixty five percent of your case.
We got it right.
That means our model is predicted.
Very good reason.
If you just multiply it with our total number of records, that will be around.
How many testing that code?
That is it, 449 testing records.
So if you multiply this number by
forty nine, we will get 425, sort of 449.
We know for 425 samples.
We got it right.
That means our model is quite accurate.
We got enough good accuracy.
We can even calculate this confusing metrics also so, so confusing metrics.
Give us a little bit more detail stuff related to our classification problem and how accurate and a
good our model is.
And let just pass.
Same like earlier.
Why test and why.
Right.
All right.
So now as we are dealing here with a binary classification problem, it will return us to cross two
metrics.
So in know diagonal elements, you can see it has radically correctly.
So in a first case, let's consider it like a.
Ham, then we always pan ham and then we spend so in off diagonal elements that that is a 24 in the
numbers.
That's where we got it wrong, that our data was ham and our system as predicted, like a spam, whereas
sometimes we eat has predicted like a spam.
But our data was a ham.
So otherwise I was.
But you know, on diagonal elements 226 and one ninety nine.
This is the case where we completely got it right.
Now, if you're dealing with, let's say, multiclass classification problem, let's say fateless classification
problem.
So in that case, you would have got this confusing matrix as a fake CROSSFIRE matrix because on a horizontally
Aldo's through label will be given a vertical, it will be given a radically limit.
Now, if you want to get more information about this confusing matrix, you can just Google around it
and you will get much more idea.
All right.
So one more is classification.
So it seemed like earlier we can pass here whiteish in a way, Fred.
And let me executed.
All right, so it doesn't display, you know, beautifully, Meinhardt, so we can just wrap it around
a print function.
All right.
So somewhat more detailed explanation about our model.
They are given like a precision recall.
Have fun, Scott.
And a support for what category?
Ham and spam.
All right.
So that is how accurate and good our model is.
A random forest.
Now, can you improve it or can you apply some other model?
So in the next video, we will see applying another model support regular machine.
So see you next video.