Skip to content

Issues when using RandomForestRegressor as estimator in HSTreeRegressor #212

@facusapienza21

Description

@facusapienza21

Hi! I am trying to use the shrinkage algorithm in some tree-based ensemble methods I have (more precisely, Random Forrest). I know how to use imodels with decision trees, but I want to use the shrinkage in a ensemble of trees just as it is mentioned at the end of the docs. Here is the example for a regression problem:

from sklearn.ensemble import RandomForestRegressor 
from imodels import HSTreeRegressor
ensemble = RandomForestRegressor()
model_imodel = HSTreeRegressor(estimator_=ensemble)
model_imodel = model.fit(X, Y)

However, it seems that the HSTreeRegressor class just accept tree methods.

InvalidParameterError: The 'decision_tree' parameter of export_text must be an instance of 'sklearn.tree._classes.DecisionTreeClassifier' or an instance of 'sklearn.tree._classes.DecisionTreeRegressor'. Got RandomForestClassifier() instead.

Is this correct? Am I doing something wrong or something has changed in the API in recent versions?

Thank you so much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions