eli5 describe_weights_xgboost KeyError:'bias'

问题描述 投票:0回答:1

我是xgboost的新手,我训练了一个模型,效果很好。现在,我尝试使用eli5查看权重,然后得到:KeyError:'bias'

-------------------------------------------------- -------------------------KeyError Traceback(最近一次通话)在3 clf6 = model6.named_steps ['clf']4 vec6 = model6.named_steps ['transformer']----> 5 describe_weights_xgboost(clf6,vec = vec6)〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / eli5 / xgboost.py在explain_weights_xgboost(xgb,vec,top,target_names,targets,feature_names,feature_re,feature_filter,重要性类型)中80 description = DESCRIPTION_XGBOOST,81 is_regression = is_regression,---> 82 num_features = coef.shape [-1],83)84〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / eli5 / _feature_importances.py in get_feature_importance_explanation(estimator,vec,cof,coef,feature_names,feature_filter,feature_re,top,description,is_regression,estimator_feature_names,num_feature coef_std)35 feature_filter = feature_filter,36 feature_re = feature_re,---> 37 num_features = num_features,38)39 feature_importances = get_feature_importances_filtered(〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / eli5 / sklearn / utils.py in get_feature_names_filtered(clf,vec,bias_name,feature_names,num_features,feature_filter,feature_re,estimator_feature_names)124 feature_names = feature_names,125 num_features = num_features,-> 126 estimator_feature_names = estimator_feature_names,127)128返回feature_names.handle_filter(feature_filter,feature_re)〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / eli5 / sklearn / utils.py in get_feature_names(clf,vec,bias_name,feature_names,num_features,estimator_feature_names)77个功能分别命名为x0,x1,x2等。78“”“-> 79,如果没有has_intercept(clf):80 bias_name =无81在has_intercept(estimator)中〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / eli5 / sklearn / utils.py60如果hasattr(estimator,'fit_intercept'):61 return estimator.fit_intercept-> 62如果hasattr(estimator,'intercept_'):63如果estimator.intercept_为None:64返回False〜/ dev / envs / env3.7 / lib / python3.7 / site-packages / xgboost / sklearn.py在intercept_(自己)中第743章第744章(一更)-> 745返回np.array(json.loads(b.get_dump(dump_format ='json')[0])['bias'])746747KeyError:“偏见”

谢谢!

python-3.x xgboost eli5
1个回答
0
投票

我也有同样的错误,如果找到一个,请分享解决方案

© www.soinside.com 2019 - 2024. All rights reserved.