code: def cross_val_score(
      estimator,
      y,
      X=None,
      scoring=None,
      cv=None,
      verbose=0,
      error_score=np.nan,
  ):
      """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.
      """
      cv_results = cross_validate(
          estimator=estimator,
          y=y,
          X=X,
          scoring=scoring,
          cv=cv,
          verbose=verbose,
          error_score=error_score,
      )
      return cv_results["test_score"]
  
imports: import numpy
  import numbers
  import warnings
  import time
  from traceback import format_exception_only
  from sklearn import base
  from sklearn.metrics import mean_absolute_error, mean_squared_error
  from sklearn.utils import indexable
  from ._split import check_cv
  from ..None import metrics
  from ..utils import check_endog
  from ..warnings import ModelFitWarning
  from ..compat.sklearn import safe_indexing
label_desc: Use image node_id 9 for calling a global function with example usage: cross_val_score(estimator, y, X, scoring, cv, verbose, error_score) and returns: cv_results