apriori() got an unexpected keyword argument 'min_support'
时间: 2023-10-05 12:08:46 浏览: 98
The error message "apriori() got an unexpected keyword argument 'min_support'" indicates that the apriori function is not recognizing the "min_support" parameter. This could be due to a version compatibility issue, or the parameter may have been renamed or removed in a newer version of the library.
To resolve this issue, you can try updating the library to the latest version. If the parameter has been renamed or removed, you may need to consult the library documentation to see what the new parameter name or alternative solution is.
相关问题
apriori() got an unexpected keyword argument 'min_confidence'
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)
```
fi = apriori(df, min_support=0.2, use_columns=True) fi报错为apriori() got an unexpected keyword argument 'use_columns'怎么改
根据错误提示,apriori函数不支持名为"use_columns"的关键字参数。可以将参数名改为"columns",并将其设置为要用于挖掘的数据集的列名。例如:
```
fi = apriori(df, min_support=0.2, columns=['Item1', 'Item2', 'Item3'])
```
其中,'Item1'、'Item2'和'Item3'是数据集中的列名。请根据你的实际情况修改为相应的列名。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)