hello, I am (name) from learnvern.( 6 seconds pause ; music )
In the continuation to the last sessions on Machine Learning, we will now learn ahead in this session.
In the machine learning tutorial, today we will learn FP Growth.
This algorithm is similar to the apriori algorithm.
Now see that in the Apriori algorithm, to execute each step,
We have to make a candidate set.
Now, to make this candidate set, our algorithm has to scan the complete database.
This is the limitation of the Apriori algorithm.
Now to overcome this limitation, we use the FP Growth algorithm.
So let us start.
Now, first of all we will import from ml-xtend(typing 3 seconds) dot frequent underscore patterns import fpgrowth. (pronounce: f p growth)
From mlxtend(typing 3 seconds) dot frequent underscore patterns import fpgrowth. , this is how we have imported the FP Growth algorithm and this module.
Now, let us move forward and create a small dataset.
So the dataset is equal to and here, in the list, we will add some number of items like milk, onion, then we can put beans.
This way, we can add items in each list.
Like in this one I have put milk, then onion, OK.
In this way, put some items of your choice in the list.
And then moving further I will create one more list and in this list I am putting onion, and along with onion I am putting in this list eggs and yogurt, OK.(read little slow, typing )...
My dataset is ready.
Now, we will work on this particular dataset.
It is a very small dataset and easy to understand, isn’t it.
So, now we will import pandas as pd and after this we will import;from ml-xtend dot preprocessing dot import and Here, we will import ( 5 second pause) transaction Encoder. (read slow, typing)
So, import pandas as pd from mlxtend dot preprocessing dot import transaction encoder, these two things we have imported.
Concentrate on that, it’s important.
Now, here we will create TE is equal to transaction encoder object and here our object has been created.
Now after this, TE underscore A R R A Y array , so te array transaction encoder array,
What is it ? TE dot fit,
we will fit dataset in it and name our dataset is dataset and we will transform it here only.
so transform and in transform also, we will pass the dataset and enter.
So in this way in te_array we have stored both training and transformation so we stored the same data in te_array.
Now, we will make a dataframe, DF is equal to pd dot dataframe, (5 seconds pause) dataframe and in the dataframe, we will pass TE underscore A R R A Y, te array, we will pass this.
Now, in the te array that we have passed, what will be the columns, so columns is equal to te dot C O L U M N S columns, OK fine.
Clear , up till Now!
So what will happen now with this is, we will get column names also and arrays also and both will get stored in df.
See here, they have been stored in our dataframe. Just see this, OK.
So with the help of transactionencoder here.
we can conclude that beans is there in the first one but the second and third one has not bought beans.
the last one has bought Eggs only,
and milk two people have bought,
onion everybody has bought and yogurt two people have not bought and only one has bought.
This is what we can understand after seeing the data, Ok.
Now through this only we will apply the FP Growth algorithm and extract the association rules.
So, from ml extend which we have already done, F P G R O W T H, fp growth.
And here we will pass df and there is one minimum support which I will keep very less for now. because you know, that my data is very less so, minimum support I will say that give me for 80%, so I have written 80, OK. So how will we write 80 here?..
What will we do here? We will give support here in decimal, but how in decimal , we will say 0.80% or we can say 0.60 to keep it at 60 %.
Minimum support we can keep 60%, 80% whatever you want. ok.
This comes at minimum support is equal to 0.60, sixty percent and now let us execute it and this will give us association rules in output.
Now you see here, with support 1 itemsets are three that means item at number three is occurring every time and that is why 1 has been displayed.
See, item number 2 is also occurring maximum times.
See here that for one one item these two are there but for two items it has returned an association of two and three, that two and three are associated,
If you buy two then the probability of buying three is also increasing and if you buy three then the probability of buying two is also increasing, OK.
So, this is how the FP Growth algorithm works.
To look at this particular notebook it looks the same as apriori but you should understand that internally it creates a tree and basically it identifies the support and item sets.
So friends we will stop today’s session here only and we will continue in the next session. Thank you very much. Keep watching, keep learning.
If you have any queries or comments, click the discussion button below the video and post there. This way, you will be able to connect to fellow learners and discuss the course. Also, Our Team will try to solve your query.
good learning but the content titles are jumbled up, like first title of this module is decision tree dichotomiser which is practical part ahead of theory part. Same with the SVM practical 1 title has
Isakki Alias Devi P
yes, i am happy to learning for machine learning in LearnVern.it i s easily understanding for Beginners.
Superb and amazing 😍🤩 enjoyable experience.
Muhammad Nazam Maqbool
Absolutely good course... will suggest it to everyone. has superb content that is covered in a fantastic way.
super course and easily understanding and Good explaned
Ruturaj Nivas Patil
Very well explained in entire course. Great course for everyone as it takes from scratch to advance level.