I have a HistGradientBoostingClassifier model and I want to plot one or more of its decision trees, nevertheless I can’t manage to find a native function to do it, I can access the Tree predictor objects and thus it’s nodes, but in order to plot it into the sklearn.tree.plot_tree function it needs to be a DecisionTree type object
I tried this:
from sklearn.tree import plot_tree
plot_tree(RF_90._predictors[0][0])
getting this error:
InvalidParameterError: The ‘decision_tree’ parameter of plot_tree must
be an instance of ‘sklearn.tree._classes.DecisionTreeClassifier’ or an
instance of ‘sklearn.tree._classes.DecisionTreeRegressor’. Got
<sklearn.ensemble._hist_gradient_boosting.predictor.TreePredictor
object at 0x7f676ebf0310> instead.
Note: RF_90 is the HistGradientBoostingClassifier fitted model
Alejandro Gonzalez is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.