pmdarima.model_selection.cross_val_score

pmdarima.model_selection.cross_val_score(estimator, y, X=None, scoring=None, cv=None, verbose=0, error_score=nan)[source][source]

Evaluate a score by cross-validation

Parameters:

estimator : estimator

An estimator object that implements the fit method

y : array-like or iterable, shape=(n_samples,)

The time-series array.

X : array-like, shape=[n_obs, n_vars], optional (default=None)

An optional 2-d array of exogenous variables.

scoring : str or callable, optional (default=None)

The scoring metric to use. If a callable, must adhere to the signature metric(true, predicted). Valid string scoring metrics include:

  • ‘smape’
  • ‘mean_absolute_error’
  • ‘mean_squared_error’

cv : BaseTSCrossValidator or None, optional (default=None)

An instance of cross-validation. If None, will use a RollingForecastCV

verbose : integer, optional

The verbosity level.

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, ModelFitWarning is raised. This parameter does not affect the refit step, which will always raise the error.

Examples using pmdarima.model_selection.cross_val_score