econml.sklearn_extensions.model_selection.GridSearchCVList

class econml.sklearn_extensions.model_selection.GridSearchCVList(estimator_list, param_grid_list, scoring=None, n_jobs=None, refit=True, cv=None, verbose=0, pre_dispatch='2*n_jobs', error_score=nan, return_train_score=False)[source]

Bases: BaseEstimator

An extension of GridSearchCV that allows for passing a list of estimators.

Each estimator can have its own parameter grid and we will return the best among all estimators in the list and hyperparameters in its corresponding grid. We are only changing the estimator parameter to estimator_list and the param_grid parameter to be a list of parameter grids. The rest of the parameters are the same as in GridSearchCV(). See the documentation of that class for explanation of the remaining parameters.

Parameters:
  • estimator_list (list of estimator object.) – Each estimator in th list is assumed to implement the scikit-learn estimator interface. Either estimator needs to provide a score function, or scoring must be passed.

  • param_grid (list of dict or list of list of dictionaries) – For each estimator, the dictionary with parameters names (str) as keys and lists of parameter settings to try as values, or a list of such dictionaries, in which case the grids spanned by each dictionary in the list are explored. This enables searching over any sequence of parameter settings.

__init__(estimator_list, param_grid_list, scoring=None, n_jobs=None, refit=True, cv=None, verbose=0, pre_dispatch='2*n_jobs', error_score=nan, return_train_score=False)[source]

Methods

__init__(estimator_list, param_grid_list[, ...])

fit(X[, y])

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

predict(X)

predict_proba(X)

set_params(**params)

Set the parameters of this estimator.

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Returns:

routing – A MetadataRequest encapsulating routing information.

Return type:

MetadataRequest

get_params(deep=True)

Get parameters for this estimator.

Parameters:

deep (bool, default=True) – If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:

params – Parameter names mapped to their values.

Return type:

dict

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:

**params (dict) – Estimator parameters.

Returns:

self – Estimator instance.

Return type:

estimator instance