在LightGBMdocumentation中,说明可以设置predict_contrib=True
来预测形状值
我们如何提取SHAP值(除了使用shap
包之外)
我试过了
model = LGBM(objective="binary",is_unbalance=True,predict_contrib=True)
model.fit(X_train,y_train)
pred_shap = opt_model.predict(X_train) #Does not get SHAP-values
这似乎不起作用
Tags:
Shap以
LGBM
的方式对pred_contrib=True
进行赋值:输出:
来自
shap
的形状值:输出:
在我看来是一样的
这种混淆是因为在两个不同的
lightgbm
API中重复了控制参数(命名不一致)两个主要API都使用自己的拼写:
而且documentation支持C版本(python API的拼写甚至不被视为别名…)
相关问题 更多 >
编程相关推荐