How do you.
So next project, which we are going to work upon is a spam detection.
Now, earlier also we use this Pam Dixon.
And we were applying mostly are those machine learning validate models.
But in this video, we are going to apply whatever we learn in this particular section, convolution
neural network.
So for detecting the spam messages, we are going to use this convolution neural network.
And all those functionality of CNN has been implemented inside this tensor flow and a Kiraz library.
So let me put all those necessary stuff was so pensive, low and so close by default, dealt with this
CoLab environment.
So you do not require any kind of installation.
Apart from that, from Haskell and Library, some training display.
These are some of the default prepossessing library like Numpty Penders and forward Zeil Edgerton,
MacRobert Live Leiby.
No new thing here is about 10 Cibolo and I get us so far preprocessing.
From the tense of low model, we are going to put this one, tokenized it under one is a padding sequence.
I will tell you what is the use of that.
Next to Bandolier, we are going to import this dense layer, input layer and meeting global max pooling.
And just max pulling and a convolution one Lilja.
And then it will be just Martin.
So let me import all those necessary stuff.
So we are going to deal with this paradox, not fight.
So let me put it from my local machine.
Kotal.
Next stop.
So how is Spam NCDC file?
All right.
So.
It is successfully applauded.
The next thing is we need to read this fight.
So let me executed.
Just Bearden's and I am using your encoding ISO eight, a finite, but otherwise you will get some error
while despite because of some very odd character exist.
So this type of encoding on Leegin, understand those character.
Let me display first few records of this Dufferin.
And you can see video of V1, V2.
And there are lots of missing data like unnamed to an employee and an input.
So in the next step, what we can do, we can just simply remove those column by name to name three
and a name for it.
So let me executed.
And our interesting part will be to call V1.
And we do so now VEO just the two column.
So based on this V2 column, we have to decide whether messages pan or it will be a ham.
Ledgers that he named the.
Column name.
So now the columns will be data and one will be labels.
So if you observe now, it will be a data and it will be a column.
Now, let's first do all those preprocessing required for the labels, like I say.
So here the output values will be written in terms of, let's say, objects, or it will be in a form
of text.
But we are going to apply neural network model on top of it.
So we have to convert this Hamman span into kind of numbers.
So we are using the label encoder and.
To convert every single hamin to zero and a spamming to one I have created here a small dictionary object.
And with the help of this math function on just label column, we are going to apply.
And you can see if I try to display let's see why I got only zero zero zero one.
So first will be ham.
So ham will be it to zero and spam will be matched to one.
Next thing is we are going to split this dataset into two different buckets.
Just like earlier, extra in excess wiping in Vytas.
So that will be a training data set and testing that does it.
And this particular function we used from the cyclone library, which you imported here.
So Skillern model selection.
Now things will be a little different compared to whatever machine learning algorithm earlier we play.
First thing is that we have a data available in a text.
So we need to apply some sort of embedding technique.
Before start applying those embedding model.
So here we are going to use a very simple bag of words and of Martin.
So every single unique character will be given one index position in a complete walkability.
So what we will do.
Let me create new cell.
And let me define this thing one by one.
So I'll get a more idea.
So here I am going to create one.
Tokenized an object.
And I'll just pass.
The number of words will be maximum walkability size.
Let's see if I try to display tokenized it.
It will be a kind of token asset class.
Next thing is we need to fit our input training dataset into a tokenized.
So let me copy and put it here.
So step by step, you will get idea.
What we're doing now once we print the training does it?
We need to transform our text into kind of sequences and those converges and Trump text two sequences.
We are going to do on a boat training the concept and testing it.
I say let me copy this one and put it into an adisa.
All right, now let me display first food, of course, of training.
Let me do with just the first record, and you can see just the set of numbers only, so the very first
record in this screen.
Let me displacement explain also.
So that will be X green and you go on day gun, whatever it will be that got zie presented by this particular
number.
Now, if you try to do land.
On the top of.
It will be a guarantee.
Now, same thing.
Let's see if you play for the next record.
He's having a next one.
So it is a thirty.
So every single record has a variable length sequence.
All right.
So now we can rotate.
Our tax later in to kind of sequence.
Next, let's try to find those vocabulary.
Then we will see about those fatty.
So vocabulary, let me know this much stuff.
Are we we can even execute this one.
So total number of unique tokens crowed this whole lower Nexus seven to fight to and from the tokenized,
plus we this information.
So we have a total unique tokens in our whole model will be selling to fight two.
Next thing is, we need to.
Create one big matrix, which we can pass on to our neural network model for doing amazing stuff.
And then we do for the convolution neural network.
So we have to do for the power sequence.
Now, why do we need to bring the sequence?
Because here we have a 20.
Now, we in a second ago, we were Carletto numbers.
So neural network accept the fixed land input.
So in that case, we need to define one fixed line input.
And we need to pair zero into it.
So let me.
Need.
And we are here.
We are using a parent and escort sequences.
Now, if you just tried to find the very first record, let's say, late on this underscore plain.
You can see there are lots of Gedo quite badly.
And then, well, 31 got stuck.
Now, if you just compare with this one or I have to print it again, this sequence.
Under Scottoline, not you.
And you can see we are at 31 44.
Well.
And you can see from here.
Well, 31, 44 percent.
So remaining all value, it has kept like a zero.
Now, if you try to find the length of this particular
individual sequence, it will be a one eighty nine.
So every single record now has been presented with.
One eighty nine numbers.
If you try to display the second record length, so that will be also seen.
So that is the whole objective behind this baffling sequence.
All right.
So I'm just winding up at this point.
And in the next video, we will see how we can build this model.
So see you in the next video.