XGBoost 模型树价值洞察
XGBoost model tree value insight
我在 Python 中创建了一个 XGBoost 模型,并使用以下代码更好地理解该模型:
xgb.plot_importance(model)
或
xgb.plot_importance(model, importance_type="gain")
我可以了解哪些参数最有价值,但似乎无法告诉我这些值是什么。
假设我要确定在某一天有多少人会租自行车。 运行 上面的两个plot_importance方法可能告诉我,'temperature'和'day of week'是决定骑车次数的最重要参数。不过,我想知道的是,哪些值决定了高骑行次数,哪些值决定了低骑行次数。
我猜你想做的是可视化和调试算法在预测时所做的事情。为此,我建议您查看 ELI5, specifically the part that covers working with XGBoost. For comprehensive example on how to use ELI5 with XGBoost on Titanic data set, check out this link.
为了解释预测,请执行以下操作:
from eli5 import show_prediction
show_prediction(moel, your_prediction, show_feature_values=True)
我在 Python 中创建了一个 XGBoost 模型,并使用以下代码更好地理解该模型:
xgb.plot_importance(model)
或
xgb.plot_importance(model, importance_type="gain")
我可以了解哪些参数最有价值,但似乎无法告诉我这些值是什么。
假设我要确定在某一天有多少人会租自行车。 运行 上面的两个plot_importance方法可能告诉我,'temperature'和'day of week'是决定骑车次数的最重要参数。不过,我想知道的是,哪些值决定了高骑行次数,哪些值决定了低骑行次数。
我猜你想做的是可视化和调试算法在预测时所做的事情。为此,我建议您查看 ELI5, specifically the part that covers working with XGBoost. For comprehensive example on how to use ELI5 with XGBoost on Titanic data set, check out this link.
为了解释预测,请执行以下操作:
from eli5 import show_prediction
show_prediction(moel, your_prediction, show_feature_values=True)