Sklearn Backend#

Hyperactive provides scikit-learn compatible interfaces that work as drop-in replacements for GridSearchCV and RandomizedSearchCV.

Example Files#

Use Case

Example

Classification with OptCV

sklearn_classif_example.py

Grid Search

grid_search_example.py

Random Search

random_search_example.py

Usage Overview#

Hyperactive’s sklearn-compatible classes follow the familiar fit/predict pattern:

from hyperactive.integrations.sklearn import HyperactiveSearchCV
from sklearn.ensemble import RandomForestClassifier

# Define search space
param_space = {
    "n_estimators": [50, 100, 200],
    "max_depth": [5, 10, 15, None],
}

# Create search object
search = HyperactiveSearchCV(
    estimator=RandomForestClassifier(),
    param_space=param_space,
    n_iter=50,
)

# Fit like any sklearn estimator
search.fit(X_train, y_train)

# Access best parameters
print(search.best_params_)

See Framework Integrations for complete documentation.