Skip to content

'RandomForestRegressor' object has no attribute 'n_outputs_' needed for the predict function #21

@antoinecomp

Description

@antoinecomp

I'm trying to test the predict function but it raises the following error:

AttributeError: 'RandomForestRegressor' object has no attribute 'n_outputs_'.

Yet it seems that actually it has when checking the sklearn webpage.

Here is the full error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-101-56bf611044fd> in <module>
      1 # checking the performance of training data itselfz
----> 2 prediction, bias, contributions = ti.predict(rf, numpy_df_train)
      3 idx = pd.date_range(train_start_date, train_end_date)
      4 predictions_df1 = pd.DataFrame(data=prediction[0:], index = idx, columns=['prices'])
      5 predictions_df1.plot()

C:\ProgramData\Anaconda3\lib\site-packages\treeinterpreter\treeinterpreter.py in predict(model, X, joint_contribution)
    193     """
    194     # Only single out response variable supported,
--> 195     if model.n_outputs_ > 1:
    196         raise ValueError("Multilabel classification trees not supported")
    197 

AttributeError: 'RandomForestRegressor' object has no attribute 'n_outputs_'

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