简体   繁体   English

AttributeError: 'SimpleImputer' object 在 PyCaret 中没有属性 '_validate_data'

[英]AttributeError: 'SimpleImputer' object has no attribute '_validate_data' in PyCaret

I am using PyCaret and get an error.我正在使用 PyCaret 并收到错误消息。

AttributeError: 'SimpleImputer' object has no attribute '_validate_data'

Trying to create a basic instance.尝试创建一个基本实例。

# Create a basic PyCaret instance
import pycaret
from pycaret.regression import *
mlb_pycaret = setup(data = pycaret_df, target = 'pts', train_size = 0.8, numeric_features = ['home', 
'first_time_pitcher'], session_id = 123)

All my variables are numeric (I coerced two of them, which are boolean).我所有的变量都是数字的(我强制了其中的两个,它们是布尔值)。 My target variable is label and this is by default.我的目标变量是label ,这是默认值。

I also installed PyCaret , imported its regression, and re-installed scikit learn , imported SimpleImputer as from sklearn.impute import SimpleImputer我还安装了PyCaret ,导入了它的回归,并重新安装了scikit learn ,将SimpleImputer导入为from sklearn.impute import SimpleImputer

OBP_avg Numeric
SLG_avg Numeric
SB_avg  Numeric
RBI_avg Numeric
R_avg   Numeric
home    Numeric
first_time_pitcher  Numeric
park_ratio_OBP  Numeric
park_ratio_SLG  Numeric
SO_avg_p    Numeric
pts_500_parkadj_p   Numeric
pts_500_parkadj Numeric
SLG_avg_parkadj Numeric
OPS_avg_parkadj Numeric
SLG_avg_parkadj_p   Numeric
OPS_avg_parkadj_p   Numeric
pts_BxP Numeric
SLG_BxP Numeric
OPS_BxP Numeric
whip_SO_BxP Numeric
whip_SO_B   Numeric
whip_SO_B_parkadj   Numeric
order   Numeric
ops x pts_500 order15   Numeric
ops x pts_500 parkadj   Numeric
ops23 x pts_500 Numeric
ops x pts_500 orderadj  Numeric
whip_p  Numeric
whip_SO_p   Numeric
whip_SO_parkadj_p   Numeric
whip_parkadj_p  Numeric
pts Label

My traceback is the following:我的回溯如下:

The problem here is with the imputation.这里的问题在于插补。 The default per pycaret documentation is 'simple' but in this case, you need to make that imputation_type='iterative' for it to work.每个pycaret 文档的默认值为 'simple',但在这种情况下,您需要使imputation_type='iterative'才能工作。

It's incompatibility of library, install pycaret again with: pip install pycaret pandas shap这是库不兼容,再次安装 pycaret: pip install pycaret pandas shap

Good day all.美好的一天。 What helped me is installing pycaret=='2.3.10 ' and scikit-learn='0.23.2' at the same time.帮助我的是同时安装 pycaret=='2.3.10 ' 和 scikit-learn='0.23.2' 。 These two version are compatible and all works fine.这两个版本是兼容的,一切正常。 I installed scikit-learn using conda as the older versions are not available through pip, and I installed Pycaret using pip3.我使用 conda 安装了 scikit-learn,因为旧版本无法通过 pip 获得,我使用 pip3 安装了 Pycaret。 I hope this helps all who have struggled to get this working like I did.我希望这可以帮助所有像我一样努力实现这项工作的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError: 'SMOTE' object 没有属性 '_validate_data' - AttributeError: 'SMOTE' object has no attribute '_validate_data' 'RandomOverSampler' object 没有属性 '_validate_data' - 'RandomOverSampler' object has no attribute '_validate_data' 'NearMiss' object 没有属性 '_validate_data' - 'NearMiss' object has no attribute '_validate_data' 逻辑回归错误 Object has no attribute '_validate_data' - Logistic regression error Object has no attribute '_validate_data' Python:“标准缩放器”object 没有属性“_validate_data” - Python: 'StandardScaler' object has no attribute '_validate_data' AttributeError: 'SimpleImputer' object 没有属性 'mean' - AttributeError: 'SimpleImputer' object has no attribute 'mean' AttributeError: 'Simple_Imputer' object 在 PyCaret 中没有属性 'fill_value_categorical'' - AttributeError: 'Simple_Imputer' object has no attribute 'fill_value_categorical'' in PyCaret Pycaret:“AttributeError:‘Simple_Imputer’object 没有属性‘target_variable’” - Pycaret : "AttributeError: 'Simple_Imputer' object has no attribute 'target_variable'" SimpleImputer 对象没有属性 _fit_dtype - SimpleImputer object has no attribute _fit_dtype 如何使 validate_data 字段可选? - How to make a validate_data field optional?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM