0
$\begingroup$

I'm trying to do market basket analysis using apriori algorithm, I'm working with mlxtend library, but the association_rules function is not returning anything !

I have tried changing the parameters values for min_support and min_threshold, I also tried using this code to set all values to either 0 or 1.

def encode_units(x):
   if x <= 0:
   return 0
   if x >= 1:
   return 1
df1 = df.applymap(encode_units)

I also checked the mlxtend version :0.17.0

the code lines I used for the algorithm.

frequent_itemsets = apriori(df, min_support=0.04, use_colnames=True)
rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1.2)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.