0

I'm trying to create a function that mines and exports association rules between item categories using the Apriori algorithm from mlxtend. While this works beautifully in jupyter notebooks. I get a type error when I copy the same function int my pycharm project.

In both cases I used mlxtend 0.15.0.0.

def apriori():



    inputPath = inputPathField.get()
    data = pd.read_csv(inputPath, usecols=['BillId', 'Level5'])



    data['dummy'] = 1



    matrix = data.pivot_table(values='dummy', index='BillId', columns='Level5').fillna(0)



    frequent_itemsets = apriori(matrix, min_support=0.0005, use_colnames=True)



    rules = association_rules(frequent_itemsets, metric="lift", min_threshold=1)



    export = rules[(rules.antecedents.str.len() <= 3)]



    export = export[(export.consequents.str.len() == 1)]


    export = export[(export.confidence >= 0.15)]


    outputPath = outputPathField.get()
    export.to_csv(outputPath)
File "/home/scrybe/PycharmProjects/tkinter/Apriori.py", line 37, in apriori
frequent_itemsets = apriori(matrix, min_support=0.0005, use_colnames=True)
TypeError: apriori() got an unexpected keyword argument 'min_support'
raakshasan
  • 55
  • 9

1 Answers1

0

The issue was that I used a function name that was already a function name in mlxtend. Once I changed it, the problem was resolved. Thanks to @vishal.

raakshasan
  • 55
  • 9