Description
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:
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.