Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

list of numeric categories of length 2 is considered as Real or Integer dimensions  #1064

@Abdelgha-4

Description

@Abdelgha-4

In skopt.Optimizer docs it said:

  • a (lower_bound, upper_bound) tuple (for Real or Integer dimensions) ...
  • as a list of categories (for Categorical dimensions) ...

however a list of length 2 is considered the same as a tuple.
a reproduceable example:

 from skopt import BayesSearchCV
from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier

X, y = load_iris(return_X_y=True)

searchcv = BayesSearchCV(
    RandomForestClassifier(),
    search_spaces={'n_estimators': [250, 500], 'max_features': (0.3, 0.95, 'uniform')},
    n_iter=10,
    cv=5,
    scoring='f1_macro',
    random_state=42
)

searchcv.fit(X, y)
print(searchcv.cv_results_['param_n_estimators'])

it shows that the optimizer tries many values between 250 and 500 and not just both values.

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