ForecastingGridSearchCV¶
-
class
sktime.forecasting.model_selection.
ForecastingGridSearchCV
(forecaster, cv, param_grid, scoring=None, n_jobs=None, refit=True, verbose=0, pre_dispatch='2*n_jobs', error_score=nan, return_train_score=False)[source]¶ Performs grid-search cross-validation to find optimal model parameters. The forecaster is fit on the initial window and then temporal cross-validation is used to find the optimal parameter
Grid-search cross-validation is performed based on a cross-validation iterator encoding the cross-validation scheme, the parameter grid to search over, and (optionally) the evaluation metric for comparing model performance. As in scikit-learn, tuning works through the common hyper-parameter interface which allows to repeatedly fit and evaluate the same forecaster with different hyper-parameters.
- Parameters
forecaster (estimator object) – The estimator should implement the sktime or scikit-learn estimator interface. Either the estimator must contain a “score” function, or a scoring function must be passed.
cv (cross-validation generator or an iterable) – e.g. SlidingWindowSplitter()
param_grid (dict or list of dictionaries) – Model tuning parameters of the forecaster to evaluate
scoring (function, optional (default=None)) – Function to score models for evaluation of optimal parameters
n_jobs (int, optional (default=None)) – Number of jobs to run in parallel. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors.
refit (bool, optional (default=True)) – Refit the forecaster with the best parameters on all the data
verbose (int, optional (default=0)) –
pre_dispatch (str, optional (default='2*n_jobs')) –
error_score (numeric value or the str 'raise', optional (default=np.nan)) – The test score returned when a forecaster fails to be fitted.
return_train_score (bool, optional (default=False)) –