crflynn / skgrf

scikit-learn compatible Python bindings for grf (generalized random forests) C++ random forest library
https://skgrf.readthedocs.io/en/stable/
GNU General Public License v3.0
31 stars 7 forks source link

add value, and some other tree properties #54

Closed crflynn closed 3 years ago

crflynn commented 3 years ago

This creates a separate _tree module for the low-level Tree class.

Here we add some post-fit methods which add detail to the serialized forest grf_forest_. These additional elements are added to enable some properties in Tree, particularly the value property. To calculate this we store leaf sample weights corresponding to leaf_samples, and leaf values of y also corresponding to leaf_samples.

In addition to value we also add the following properties also found in sklearn

We also modify feature and threshold to return -2 for leaf nodes as sklearn does. We also modify the default n_classes_ fit attribute to 1 rather than None in the case of no cluster data.