chainladder.GridSearch

Contents

chainladder.GridSearch#

class chainladder.GridSearch(estimator, param_grid, scoring, verbose=0, error_score='raise', n_jobs=None)#

Exhaustive search over specified parameter values for an estimator. Important members are fit, predict. GridSearchCV implements a “fit” and a “score” method. It also implements “predict”, “predict_proba”, “decision_function”, “transform” and “inverse_transform” if they are implemented in the estimator used. The parameters of the estimator used to apply these methods are optimized by cross-validated grid-search over a parameter grid.

Parameters:
estimator: estimator object.

This is assumed to implement the chainladder estimator interface.

param_grid: dict or list of dictionaries

Dictionary with parameters names (string) 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.

scoring: callable or dict of callable(s)

Should be of the form {‘name’: callable}. The callable(s) should return a single value.

verbose: integer

Controls the verbosity: the higher, the more messages.

error_score: ‘raise’ or numeric

Value to assign to the score if an error occurs in estimator fitting. If set to ‘raise’, the error is raised. If a numeric value is given, FitFailedWarning is raised. This parameter does not affect the refit step, which will always raise the error. Default is ‘raise’ but from version 0.22 it will change to np.nan.

n_jobs: int, default=None

The number of jobs to use for the computation. This will only provide speedup for n_targets > 1 and sufficient large problems. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.

Attributes:
results_: DataFrame

A DataFrame with each param_grid key as a column and the scoring score as the last column

Methods

fit(X[, y])

Fit the model with X.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.