如何解决lightgbm不能自行检测分类特征
hyper_params = {
'task': 'train','objective': 'regression','metric': ['l2','auc'],'learning_rate': 0.005,"num_leaves": 128,'categorical_feature':'auto',"num_iterations": 10000,"n_estimators": 100
}
lgb = LGBMRegressor(**hyper_params)
lgb.fit(X_train,y_train,eval_set = [(X_valid,y_valid)],eval_metric='l1',early_stopping_rounds=100
)
即使在'categorical_feature':'auto',
之后,我的X_train仍包含类别变量
ValueError: DataFrame.dtypes for data must be int,float or bool.
Did not expect the data types in the following fields: MSZoning,Street,LotShape,...
如果我愿意
obj_feat = list(X_train.loc[:,X_train.dtypes == 'object'].columns.values)
obj_feat
我能够获得具有分类对象类型的特征
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。