pmdarima.model_selection.cross_validate

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

Evaluate metric(s) by cross-validation and also record fit/score times.

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.