Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Scikit learn Scikit learn EnableHalvingSearchCV

From Leeroopedia


Knowledge Sources
Domains Machine Learning, Hyperparameter Tuning
Last Updated 2026-02-08 15:00 GMT

Overview

Concrete tool for enabling the experimental Successive Halving search-estimators in scikit-learn's model_selection module.

Description

Importing this module dynamically sets HalvingRandomSearchCV and HalvingGridSearchCV as attributes of the sklearn.model_selection module. These are experimental estimators that implement the Successive Halving strategy for hyperparameter search, which progressively eliminates poor candidates using increasing amounts of resources.

Usage

Import this module before importing HalvingRandomSearchCV or HalvingGridSearchCV from sklearn.model_selection. This is required because these estimators are experimental and their API may change without deprecation cycles.

Code Reference

Source Location

Signature

# Module-level side effects:
from sklearn.model_selection._search_successive_halving import (
    HalvingGridSearchCV,
    HalvingRandomSearchCV,
)
setattr(model_selection, "HalvingRandomSearchCV", HalvingRandomSearchCV)
setattr(model_selection, "HalvingGridSearchCV", HalvingGridSearchCV)

Import

from sklearn.experimental import enable_halving_search_cv  # noqa
from sklearn.model_selection import HalvingRandomSearchCV, HalvingGridSearchCV

I/O Contract

Inputs

Name Type Required Description
(none) N/A N/A This is a side-effect module; importing it enables the experimental estimators

Outputs

Name Type Description
HalvingRandomSearchCV class Experimental successive halving random search estimator added to model_selection
HalvingGridSearchCV class Experimental successive halving grid search estimator added to model_selection

Usage Examples

Basic Usage

from sklearn.experimental import enable_halving_search_cv  # noqa
from sklearn.model_selection import HalvingGridSearchCV
from sklearn.ensemble import RandomForestClassifier

clf = RandomForestClassifier(random_state=0)
param_grid = {"max_depth": [3, 5, 10], "min_samples_split": [2, 5, 10]}
search = HalvingGridSearchCV(clf, param_grid, random_state=0)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment