apriori() got an unexpected keyword argument 'min_confidence'
时间: 2023-10-05 09:11:47 浏览: 514
Apriori_Matlab.rar_Apriori_MATLAB apriori_apriori algorithm_apri
The error message "apriori() got an unexpected keyword argument 'min_confidence'" indicates that the function apriori() was called with an argument 'min_confidence' which is not recognized by the function.
The apriori() function is a part of the mlxtend library which is used for implementing the Apriori algorithm, a popular algorithm used for association rule mining. The Apriori algorithm searches for frequent itemsets in a dataset and generates association rules between them.
The correct argument for setting the minimum confidence level for generating association rules is 'min_threshold', not 'min_confidence'. So, you should modify your code to use 'min_threshold' instead of 'min_confidence'.
Here's an example:
```
from mlxtend.frequent_patterns import apriori, association_rules
frequent_itemsets = apriori(df, min_support=0.1, use_colnames=True)
rules = association_rules(frequent_itemsets, metric="confidence", min_threshold=0.5)
```
阅读全文