sklearn.model_selection.fit_grid_point

sklearn.model_selection.fit_grid_point(X, y, estimator, parameters, train, test, scorer, verbose, error_score=nan, **fit_params)[source]

Run fit on one set of parameters.

Parameters
Xarray-like, sparse matrix or list

Input data.

yarray-like or None

Targets for input data.

estimatorestimator object

A object of that type is instantiated for each grid point. This is assumed to implement the scikit-learn estimator interface. Either estimator needs to provide a score function, or scoring must be passed.

parametersdict

Parameters to be set on estimator for this grid point.

trainndarray, dtype int or bool

Boolean mask or indices for training set.

testndarray, dtype int or bool

Boolean mask or indices for test set.

scorercallable or None

The scorer callable object / function must have its signature as scorer(estimator, X, y).

If None the estimator’s score method is used.

verboseint

Verbosity level.

**fit_paramskwargs

Additional parameter passed to the fit function of the estimator.

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 np.nan.

Returns
scorefloat

Score of this parameter setting on given test split.

parametersdict

The parameters that have been evaluated.

n_samples_testint

Number of test samples in this split.