Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug] Deprecated max_features="auto" in RandomForestRegressor causes UnboundLocalError in sklearn versions >=1.3 #212

Copy link
Copy link
Closed
@davdma

Description

@davdma
Issue body actions

Describe the Bug

This line of RandomForestRegressor class in deephyper/deephyper/skopt/learning/forest.py causes problems in conjunction with newer versions of sklearn 1.3.0 and above. The max_features="auto" parameter was deprecated and ultimately removed in sklearn 1.3.0, so that instantiating a tree from sklearn using such a default parameter causes the self.max_features variable to fall through a gap in their conditional statements. The result is that the max_features variable is not instantiated and a UnboundLocalError thrown when it is later referenced in the sklearn source code.

The error can be replicated by installing sklearn version 1.3.0 and above and instantiating CBO with surrogate_model="RF" and calling method fit_surrogate(df). The error is shown below:

error

Describe Your Proposed Solution

The current documentation should specify that the RF surrogate model will not work with sklearn versions 1.3.0 and above. Else, the code needs to remove the deprecated max_features="auto" parameter. I suggest setting the default to max_features=None which in sklearn would have the same behavior as with the earlier versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.