sklearn.model_selection.fit_grid_point

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

Run fit on one set of parameters.

Parameters:
X : array-like, sparse matrix or list

Input data.

y : array-like or None

Targets for input data.

estimator : estimator 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.

parameters : dict

Parameters to be set on estimator for this grid point.

train : ndarray, dtype int or bool

Boolean mask or indices for training set.

test : ndarray, dtype int or bool

Boolean mask or indices for test set.

scorer : callable 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.

verbose : int

Verbosity level.

**fit_params : kwargs

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 ‘raise’ but from version 0.22 it will change to np.nan.

Returns:
score : float

Score of this parameter setting on given test split.

parameters : dict

The parameters that have been evaluated.

n_samples_test : int

Number of test samples in this split.