如何提取 GradientBosstingClassifier 的决策规则 [英] how to extract decision rules of GradientBosstingClassifier
问题描述
我想提取和可视化 scikit-learn GradientBoostingClassifier
的决策规则.如果它只是一个 DecisionTreeClassifier,我会使用 tree.export_graphviz
,但 GradientBoostingClassifier
是一组树.我不知道如何对它们使用 export_graphviz
.
I want to extract and visualize the decision rules of a scikit-learn GradientBoostingClassifier
. If it were just one DecisionTreeClassifier I'd use tree.export_graphviz
, but GradientBoostingClassifier
is an ensemble of trees. I don't know how I'd use export_graphviz
on them.
如果有人知道这样做的方法,那将非常有帮助.
If anyone knows of a way to do so, it will be very helpful.
推荐答案
有人解决了这个问题.您可以使用 clf.estimators_ 检索对应于每个 boosting 阶段的 DecisionTreeRegressor 对象,并调用 export_graphviz 生成树可视化..http://scikit-learn.org/stable/modules/生成/sklearn.ensemble.GradientBoostingClassifier.html"
Someone has solved the problem. "You can use clf.estimators_ to retrieve the DecisionTreeRegressor objects corresponding to each boosting stage and call export_graphviz to generate the tree visualization.. http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html"
这篇关于如何提取 GradientBosstingClassifier 的决策规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!