timmens / causal-forest

Implements the Causal Forest algorithm formulated in Athey and Wager (2018).
MIT License
65 stars 12 forks source link

Fix bug in CausalForest load method. #14

Closed timmens closed 4 years ago

timmens commented 4 years ago

When saving and loading a model I need to save additional information, e.g., the number of predictors, etc., and when loading I need to set these parameters in the new CausalForest object.

timmens commented 4 years ago

The bug was fixed in 50af40c7833. The main problem was that when writing the model to disc num_features were not written, so when later loading the model, it was not possible to use the predict method correctly. I solved the problem by writing num_features to the column name of split_feat, i.e. for k features this would be split_feat(k). This way the information is easily accessible when loading.