apriori() got an unexpected keyword argument 'min_support'
时间: 2023-10-01 20:03:43 浏览: 188
关联规则挖掘Apriori算法
3星 · 编辑精心推荐
The `apriori()` function is a part of the `mlxtend` library and is used for association rule mining. The error message you received suggests that you are passing an unexpected argument `min_support` to the function.
`min_support` is a parameter of the `Apriori` class constructor, not the `apriori()` function. To specify the minimum support threshold for the algorithm, you should create an instance of the `Apriori` class and pass the `min_support` argument there.
Here's an example:
```
from mlxtend.frequent_patterns import Apriori
# Create an instance of the Apriori class with min_support=0.5
ap = Apriori(min_support=0.5)
# Apply the apriori algorithm to your dataset
frequent_itemsets = ap.fit_transform(dataset)
```
In this example, `min_support` is set to 0.5 when creating an instance of the `Apriori` class, and then the `fit_transform()` method is called to generate frequent itemsets from the dataset.
阅读全文