parrt / dtreeviz

A python library for decision tree visualization and model interpretation.
MIT License
2.89k stars 332 forks source link

_regr_leaf_viz calculates the mean for prediction value. #291

Closed tlapusan closed 1 year ago

tlapusan commented 1 year ago

_regr_leaf_viz() function calculates itself the mean of values for leaf prediction (for regression tree)!

It should use the node.prediction() instead because in some cases we can take the leaf prediction value directly from the tree metadata, which is the correct way to do.

For example, the sklearn by default calculates the median for leaf prediction -> dtreeviz shows the mean, which is not correct.