I have been trying to use apriori algorithm in my Jupyter notebook as well as Google Colab but keep running into the same error. I did everything that i could find. Installed mlxtend package through pip first but it was installed on an entirely different channel. Then i tried to install it through condaforge(according to the official anaconda website) but still faced the same issue. Tried to first import the package and then use it but again, faced the same above error as the title. Similar experience in Google Colab. Can someone please help me with this?
import mlxtend
from mlxtend.frequent_pattens import apriori
from mlxtend.frequent_patterns import association_rules, apriori
frq_items = apriori(new, min_support = 0.05, use_colnames = True)
rules = association_rules(frq_items, metric ="lift", min_threshold = 1)
rules = rules.sort_values(['confidence', 'lift'], ascending =[False, False])
print(rules.head())
Error:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-17-26d4aeb9df8a> in <module>
1 import mlxtend
----> 2 from mlxtend.frequent_pattens import apriori
3 from mlxtend.frequent_patterns import association_rules, apriori
4
5 frq_items = apriori(new, min_support = 0.05, use_colnames = True)
ModuleNotFoundError: No module named 'mlxtend.frequent_pattens
Here, new is my input dataframe and I am facing error in the 2nd line of code. I do have to mention that I have the latest version of mlxtend which is 0.21.0
I shall delete this question as I figured out the error. It was a simple spelling error.
I had missed the 'r' in patterns.