Halaal So before going deep dive into this session, let's have a quick recap of what we have done in
our previous session from the previous session.
We have basically performed one hot encoding on airlines destination as well as on source.
Still, we have lots of column that we still have to deal with that.
So basically those are route totally stops and additional info.
So in this column, so in this session, we have to deal with this basically this route column.
So you will see here, this is exactly separator.
So if you will separate this data on the basis of this separator, MARCOSSON, that you guys get off
school, I have to separate it because this is your data and machine learning.
Just don't understand.
What is this route column for?
You have to make machine learning to understand.
Yeah, this is my route one.
This is my route to this is my duty.
What is my route.
And so you have to make to learn to machine learning algorithm, whatever algorithm you are going to
use in upcoming session.
So here are what I am going to do.
I'm just like saying I'm going to access very first what is monitoring.
And on this, if I'm going to access my route, you will see where you have all these different different
routes.
So now basically I have to basically I have to split this on a basis of this apparatus.
If I'm going to execute it, you will see it will exactly return a list which will get splitted basically
on the basis of separate what you are going to pass.
Let's say I have to access this very first route, BLR, which denotes my Bangalor.
So if you have to access this, you are going to say start of zero, it's just executed.
You will get your data of Route one.
So what I'm going to do, I'm just going to copy.
Let's I have to store it somewhere else before it.
So I'm going to say categorical all let's say RWB underscore one that said this is my horse too.
So I'm just going to store it after it.
What do we have to do?
I'm just going to copy this entire code and I have to pay for forward to Route three to four and still
good flight.
So just do a modification to three.
Similarly four.
Similarly, I have five over there and after it we have to exit as one.
This is two here.
I have to exit data of three here.
I have to exit the data of fourth index, so just execute it.
And if I'm going to call I had on my data frame.
Now you will see over here these all the five rules have been added in your data frame.
So now this route column makes no sense at all.
So far.
This what you can do.
You guys can simply delay this for four days.
I'm going to use this to our columns here very first to mention what exactly my name is, Astrid.
I have to mention what is my future name.
So just executed.
It will remove this route column from your data frame.
So after it, let's say I'm going to check whether I have any null values or not.
So for this, I'm going to call this null or somewhere that you will see this feature has that this
feature has that much and this feature has that much support is what I'm going to do wherever I have
any missing value, just replace it with none.
So basically, I'm going to trade on for I in, let's say very first, if I'm going to print whatever
my column names, who will see I have to.
I trade on Route three or four, Route five, because these are the column that exactly contain missing
value.
So now I have to say, wherever I have this column, I'm going to trade on each and every column and
I'm going to say categorical.
I don't Filani and how I have to fill I have to fill it with none.
And after it I'm going to use my in place parameter and here I have to pass through because I have to
update my data stream as well.
So if I'm going to execute all this stuff gets executed and if I say I'm going to cross-check.
So again you can call this is not dorsum.
And this time you will also you don't have any missing value in data because you have gold, you know,
very smartly, Oria.
And if you are that much not compatible with this code, you can do separately for Routley three then
for.
Good for them, for all.
But if you are going to work from real world today, you have to write a code in such a way.
That's what I'm going to show you in that much it.
So after it, what do you guys have to do?
Let's say I have to print.
Yeah.
Each and every feature has how many categories.
So what I'm going to do so far I in categorical columns and after what I have to print, I have to print.
Yeah.
How many categories in each and every feature.
I have to write all these things in my print statement.
So here I going to say I have to add a placeholder and whatever value I will see placeholder in this
placeholder, I'm simply going to receive it via my format function.
So I'm going to say a placeholder has to total that much categories and I have to simply receive these
values via my format function.
And in this format, I have to say basically this.
I will be over for a placeholder and the second placeholder will get replaced by categorical of I dot
value counts because you have to count in each and every feature.
And on this you can call whatever will be its length.
So if I'm going to execute it now, you will see over here your line has that much feature on each and
every feature has that much feature and you will observe over a thing over here.
Ruud has basically this much better rule to do.
Three and four has a higher number of features.
And if you are going to use one hot encoding over here, that will create a more number of columns and
that will definitely create some problem for the algorithm that you are going to use because your data
becomes huge.
So that's the issue when you are going to use one not encoding.
So to get rid of that issue, to get rid of this high dimensionality issue, we are going to use lable
encoder.
So very first you have to import that class.
So for this, I'm going to say from Escalon, we have to use our proposing module in that I have my
label in order to just execute it.
And after it, we have to do I have to simply initialize this level encoder.
So using this encoder, I have to encode my all the column.
So what I'm going to do, let's say very first, I'm going to print all the column names, then after
it, what I have to do, let's say what I'm going to do and we do.
I trade on each and every feature so far, I, I, I'm, I treat as for I and then I have to encode
it for this.
I have to use this in order.
And in this I have a function within the transform and I have to transform it.
So what I have I have to transform each and every I.
So here I'm going to say categorical.
I similarly I have to update it as well.
So what I have to update, I have to update each and every item.
So I'm going to say this, this, this and just executed after it.
If I'm going to go head on my data now, we will see over here all your root feature gets converted
into Intisar format.
That's what we exactly need because my machine learning only understand.
Yeah.
What is the meaning of this?
A value and machine learning.
Now understand my Thaxted.
That's why we are going to deal with this feature encoding and now we have to deal with this basically
this tortellinis because as well as this additional info.
But we will know this over here in most of the rules, we have this new information provided.
So basically we can drop this column.
So for this, I'm going to say just drop this column in here.
Very first.
I have to mention what exactly is after it.
I have to mention this feature name, which is exactly additional underscore force, infosec just executed
after it.
We have to deal with this total on this code is tops feature for this.
I have to access categorical and here I have to access this, this, this and on this.
If I'm going to call uni now, you will see each and every unique item available in this total on this
feature you will see stop to and all these things.
So in machine learning that we're able to understand what is the meaning of this nice talk to what we
can do.
We can replace this stop with zero.
This to start with two one, start with one, three, three and four to stop.
So for this, what I am going to do, instead of using cyclone labor in a glass, we are going to use
some own approach.
We are going to use a custom approach.
Basically, we are going to define a dictionary over there and in this dictionary, wherever, I'm going
to say whatever I have noticed or just replace it with zero wherever I have to stop, replace it with
two.
One is to replace it with one tree to replace it with three four to stop, replace it with four.
That's it.
And after it, what I have to do, I have to map this dictionary to my daughter on is stops.
So this I have to use a map or did and what I have to map, I have to map this dictionary after it.
I have to update this feature as well.
So I'm going to say categorical of total stuff to just execute it.
And if I'm going to call, I had on my date of and you will see all your future guests convert into
some Intisar format.
That's what I actually want.
Now, what you have to do, you have to simply concat this categorical data frame and all the previous
data from that.
You have defined that airlines data frame and this is your source, do the same and this is your airline
little frame as well as you have some destination it affects.
So you have to concatenate all these data in four days.
I'm going to use this concat function of one does module.
And here very first, I have to mention my categorical.
The second one is exactly my airline.
The third one is exactly my source.
The fourth one is exactly my destination, not text top.
Is it exactly my destination.
And here the fifth one is exactly my Kreen underscore data and here you have to pass that list, which
is exactly created by you, which is continuous in this column, which contains all the continuous data.
And after it, what you have to do, you have the same access parameter as one because you have to concatenate
in a vertical question.
So just assign a small Brisas order.
I'm going to store it all this stuff collecting data on the school train.
So just execute all this thing.
And if I'm going to call, let's say had on this data, you'll see this is that data frame that you
actually need.
But you will notice over here some of the column you can see over here in this data frame as you have
that over here.
But you will think a new issue here that is still you have this Erlend column, the source column,
the destination column.
So what I'm going to do, I'm simply going to drop all these features.
So what I'm going to do, I'm going to do this job and column.
And here I have to say my data for a minute and it's kallikrein.
And my column name is nothing but my airline column.
And I have to just copy and just paste.
Just paste.
This time I'm going to say I have to remove my source column as well.
And this time I'm going to say this time I have to remove my destination feature just executed all this
dots get executed over here and is I'm going to execute my head over there.
You will see all of this stuff gets executed.
Oria, let's say you have to visualize you have to see all the thirty five columns.
So in such case, you have to extend its limit, the limit of Bonnar.
So for this, what I'm going to do, I'm going to call a set on this call option and here you guys can
set or display dot max on the score calls and what you have a display you have on display.
You're thirty five columns and after eight, I am just going to call ahead on my data and a Scottrade.
So just execute it and now we will see all over my column means are exactly these ones.
That's all about the session.
Hopefully you love the session very much so thank you guys.
Have a nice day.
Keep learning.
Keep growing.
Keep practicing.