如何让 python 为 xgboost 生成 tweedie 偏差?
How to get python to generate the tweedie deviance for xgboost?
使用 statsmodel 的 GLM,tweedie 偏差包含在汇总函数中,但我不知道如何为 xgboost 执行此操作。阅读 API 也没有帮助。
在 Python 中,您就是这样做的。假设 predictions
是梯度提升树的结果,real
是实际数字。然后使用 statsmodels
你会 运行 这个:
import statsmodels as sm
dev = sm.families.Tweedie(pow_var=1.5).deviance(predictions, real)
使用 statsmodel 的 GLM,tweedie 偏差包含在汇总函数中,但我不知道如何为 xgboost 执行此操作。阅读 API 也没有帮助。
在 Python 中,您就是这样做的。假设 predictions
是梯度提升树的结果,real
是实际数字。然后使用 statsmodels
你会 运行 这个:
import statsmodels as sm
dev = sm.families.Tweedie(pow_var=1.5).deviance(predictions, real)