class_docstr: This class turns any regressor compatible with the scikit-learn API into a
  recursive autoregressive (multi-step) forecaster for multiple series with a custom
  function to create predictors.
  
  Parameters
  ----------
  regressor : regressor or pipeline compatible with the scikit-learn API
      An instance of a regressor or pipeline compatible with the scikit-learn API.
  fun_predictors : Callable
      Function that receives a time series as input (numpy ndarray) and returns
      another numpy ndarray with the predictors. The same function is applied 
      to all series.
  window_size : int
      Size of the window needed by `fun_predictors` to create the predictors.
  name_predictors : list, default `None`
      Name of the predictors returned by `fun_predictors`. If `None`, predictors are
      named using the prefix 'custom_predictor_<i>' where `i` is the index of the 
      position the predictor has in the returned array of `fun_predictors`.
  transformer_series : transformer (preprocessor), dict, default `sklearn.preprocessing.StandardScaler`
      An instance of a transformer (preprocessor) compatible with the scikit-learn
      preprocessing API with methods: fit, transform, fit_transform and 
      inverse_transform. Transformation is applied to each `series` before training 
      the forecaster. ColumnTransformers are not allowed since they do not have 
      inverse_transform method.
  
      - If single transformer: it is cloned and applied to all series. 
      - If `dict` of transformers: a different transformer can be used for each series.
  transformer_exog : transformer, default `None`
      An instance of a transformer (preprocessor) compatible with the scikit-learn
      preprocessing API. The transformation is applied to `exog` before training the
      forecaster. `inverse_transform` is not available when using ColumnTransformers.
  weight_func : Callable, dict, default `None`
      Function that defines the individual weights for each sample based on the
      index. For example, a function that assigns a lower weight to certain dates. 
      Ignored if `regressor` does not have the argument `sample_weight` in its 
      `fit` method. See Notes section for more details on the use of the weights.
  
      - If single function: it is applied to all series. 
      - If `dict` {'series_column_name' : Callable}: a different function can be
      used for each series, a weight of 1 is given to all series not present 
      in `weight_func`.
  series_weights : dict, default `None`
      Weights associated with each series {'series_column_name' : float}. It is only
      applied if the `regressor` used accepts `sample_weight` in its `fit` method. 
      See Notes section for more details on the use of the weights.
  
      - If a `dict` is provided, a weight of 1 is given to all series not present
      in `series_weights`.
      - If `None`, all levels have the same weight.
  fit_kwargs : dict, default `None`
      Additional arguments to be passed to the `fit` method of the regressor.
  forecaster_id : str, int, default `None`
      Name used as an identifier of the forecaster.
  
  Attributes
  ----------
  regressor : regressor or pipeline compatible with the scikit-learn API
      An instance of a regressor or pipeline compatible with the scikit-learn API.
  fun_predictors : Callable
      Function that receives a time series as input (numpy ndarray) and returns
      another numpy ndarray with the predictors. The same function is applied 
      to all series.
  source_code_fun_predictors : str
      Source code of the custom function used to create the predictors.
  window_size : int
      Size of the window needed by `fun_predictors` to create the predictors.
  name_predictors : list
      Name of the predictors returned by `fun_predictors`. If `None`, predictors are
      named using the prefix 'custom_predictor_<i>' where `i` is the index of the 
      position the predictor has in the returned array of `fun_predictors`.
  transformer_series : transformer (preprocessor), dict
      An instance of a transformer (preprocessor) compatible with the scikit-learn
      preprocessing API with methods: fit, transform, fit_transform and 
      inverse_transform. Transformation is applied to each `series` before training 
      the forecaster. ColumnTransformers are not allowed since they do not have 
      inverse_transform method.
  
      - If single transformer: it is cloned and applied to all series. 
      - If `dict` of transformers: a different transformer can be used for each series.
  transformer_series_ : dict
      Dictionary with the transformer for each series. It is created cloning the 
      objects in `transformer_series` and is used internally to avoid overwriting.
  transformer_exog : transformer (preprocessor)
      An instance of a transformer (preprocessor) compatible with the scikit-learn
      preprocessing API. The transformation is applied to `exog` before training the
      forecaster. `inverse_transform` is not available when using ColumnTransformers.
  weight_func : Callable, dict
      Function that defines the individual weights for each sample based on the
      index. For example, a function that assigns a lower weight to certain dates. 
      Ignored if `regressor` does not have the argument `sample_weight` in its 
      `fit` method. See Notes section for more details on the use of the weights.
  
      - If single function: it is applied to all series. 
      - If `dict` {'series_column_name' : Callable}: a different function can be
      used for each series, a weight of 1 is given to all series not present 
      in `weight_func`.
  weight_func_ : dict
      Dictionary with the `weight_func` for each series. It is created cloning the 
      objects in `weight_func` and is used internally to avoid overwriting.
  source_code_weight_func : str, dict
      Source code of the custom function(s) used to create weights.
  series_weights : dict
      Weights associated with each series {'series_column_name' : float}. It is only
      applied if the `regressor` used accepts `sample_weight` in its `fit` method. 
      See Notes section for more details on the use of the weights.
  
      - If a `dict` is provided, a weight of 1 is given to all series not present
      in `series_weights`.
      - If `None`, all levels have the same weight.
  series_weights_ : dict
      Weights associated with each series.It is created as a clone of `series_weights`
      and is used internally to avoid overwriting.
  window_size : int
      Size of the window needed by `fun_predictors` to create the predictors.
  last_window : pandas Series
      Last window seen by the forecaster during training. It stores the values 
      needed to predict the next `step` immediately after the training data.
  index_type : type
      Type of index of the input used in training.
  index_freq : str
      Frequency of Index of the input used in training.
  index_values : pandas Index
      Values of Index of the input used in training.
  training_range: pandas Index
      First and last values of index of the data used during training.
  included_exog : bool
      If the forecaster has been trained using exogenous variable/s.
  exog_type : type
      Type of exogenous variable/s used in training.
  exog_dtypes : dict
      Type of each exogenous variable/s used in training. If `transformer_exog` 
      is used, the dtypes are calculated after the transformation.
  exog_col_names : list
      Names of columns of `exog` if `exog` used in training was a pandas
      DataFrame.
  series_col_names : list
      Names of the series (levels) used during training.
  X_train_col_names : list
      Names of columns of the matrix created internally for training.
  fit_kwargs : dict
      Additional arguments to be passed to the `fit` method of the regressor.
  in_sample_residuals : dict
      Residuals of the model when predicting training data. Only stored up to
      1000 values in the form `{level: residuals}`. If `transformer_series` 
      is not `None`, residuals are stored in the transformed scale.
  out_sample_residuals : dict
      Residuals of the model when predicting non-training data. Only stored
      up to 1000 values in the form `{level: residuals}`. If `transformer_series` 
      is not `None`, residuals are assumed to be in the transformed scale. Use 
      `set_out_sample_residuals()` method to set values.
  fitted : bool
      Tag to identify if the regressor has been fitted (trained).
  creation_date : str
      Date of creation.
  fit_date : str
      Date of last fit.
  skforecast_version : str
      Version of skforecast library used to create the forecaster.
  python_version : str
      Version of python used to create the forecaster.
  forecaster_id : str, int
      Name used as an identifier of the forecaster.
  
  Notes
  -----
  The weights are used to control the influence that each observation has on the
  training of the model. `ForecasterAutoregMultiseries` accepts two types of weights. 
  If the two types of weights are indicated, they are multiplied to create the final
  weights. The resulting `sample_weight` cannot have negative values.
  
  - `series_weights` : controls the relative importance of each series. If a 
  series has twice as much weight as the others, the observations of that series 
  influence the training twice as much. The higher the weight of a series 
  relative to the others, the more the model will focus on trying to learn 
  that series.
  - `weight_func` : controls the relative importance of each observation 
  according to its index value. For example, a function that assigns a lower 
  weight to certain dates.
class_docstr_tok: ["This","class","turns","any","regressor","compatible","with","the","scikit-learn","API","into","a","recursive","autoregressive","(","multi-step",")","forecaster","for","multiple","series","with","a","custom","function","to","create","predictors",".","Parameters","--","--","--","--","--","regressor",":","regressor","or","pipeline","compatible","with","the","scikit-learn","API","An","instance","of","a","regressor","or","pipeline","compatible","with","the","scikit-learn","API",".","fun_predictors",":","Callable","Function","that","receives","a","time","series","as","input","(","numpy","ndarray",")","and","returns","another","numpy","ndarray","with","the","predictors",".","The","same","function","is","applied","to","all","series",".","window_size",":","int","Size","of","the","window","needed","by","`","fun_predictors","`","to","create","the","predictors",".","name_predictors",":","list",",","default","`","None","`","Name","of","the","predictors","returned","by","`","fun_predictors","`",".","If","`","None","`",",","predictors","are","named","using","the","prefix","'custom_predictor_","<","i",">","'","where","`","i","`","is","the","index","of","the","position","the","predictor","has","in","the","returned","array","of","`","fun_predictors","`",".","transformer_series",":","transformer","(","preprocessor",")",",","dict",",","default","`","sklearn.preprocessing.StandardScaler","`","An","instance","of","a","transformer","(","preprocessor",")","compatible","with","the","scikit-learn","preprocessing","API","with","methods",":","fit",",","transform",",","fit_transform","and","inverse_transform",".","Transformation","is","applied","to","each","`","series","`","before","training","the","forecaster",".","ColumnTransformers","are","not","allowed","since","they","do","not","have","inverse_transform","method",".","-","If","single","transformer",":","it","is","cloned","and","applied","to","all","series",".","-","If","`","dict","`","of","transformers",":","a","different","transformer","can","be","used","for","each","series",".","transformer_exog",":","transformer",",","default","`","None","`","An","instance","of","a","transformer","(","preprocessor",")","compatible","with","the","scikit-learn","preprocessing","API",".","The","transformation","is","applied","to","`","exog","`","before","training","the","forecaster",".","`","inverse_transform","`","is","not","available","when","using","ColumnTransformers",".","weight_func",":","Callable",",","dict",",","default","`","None","`","Function","that","defines","the","individual","weights","for","each","sample","based","on","the","index",".","For","example",",","a","function","that","assigns","a","lower","weight","to","certain","dates",".","Ignored","if","`","regressor","`","does","not","have","the","argument","`","sample_weight","`","in","its","`","fit","`","method",".","See","Notes","section","for","more","details","on","the","use","of","the","weights",".","-","If","single","function",":","it","is","applied","to","all","series",".","-","If","`","dict","`","{","'series_column_name","'",":","Callable","}",":","a","different","function","can","be","used","for","each","series",",","a","weight","of","1","is","given","to","all","series","not","present","in","`","weight_func","`",".","series_weights",":","dict",",","default","`","None","`","Weights","associated","with","each","series","{","'series_column_name","'",":","float","}",".","It","is","only","applied","if","the","`","regressor","`","used","accepts","`","sample_weight","`","in","its","`","fit","`","method",".","See","Notes","section","for","more","details","on","the","use","of","the","weights",".","-","If","a","`","dict","`","is","provided",",","a","weight","of","1","is","given","to","all","series","not","present","in","`","series_weights","`",".","-","If","`","None","`",",","all","levels","have","the","same","weight",".","fit_kwargs",":","dict",",","default","`","None","`","Additional","arguments","to","be","passed","to","the","`","fit","`","method","of","the","regressor",".","forecaster_id",":","str",",","int",",","default","`","None","`","Name","used","as","an","identifier","of","the","forecaster",".","Attributes","--","--","--","--","--","regressor",":","regressor","or","pipeline","compatible","with","the","scikit-learn","API","An","instance","of","a","regressor","or","pipeline","compatible","with","the","scikit-learn","API",".","fun_predictors",":","Callable","Function","that","receives","a","time","series","as","input","(","numpy","ndarray",")","and","returns","another","numpy","ndarray","with","the","predictors",".","The","same","function","is","applied","to","all","series",".","source_code_fun_predictors",":","str","Source","code","of","the","custom","function","used","to","create","the","predictors",".","window_size",":","int","Size","of","the","window","needed","by","`","fun_predictors","`","to","create","the","predictors",".","name_predictors",":","list","Name","of","the","predictors","returned","by","`","fun_predictors","`",".","If","`","None","`",",","predictors","are","named","using","the","prefix","'custom_predictor_","<","i",">","'","where","`","i","`","is","the","index","of","the","position","the","predictor","has","in","the","returned","array","of","`","fun_predictors","`",".","transformer_series",":","transformer","(","preprocessor",")",",","dict","An","instance","of","a","transformer","(","preprocessor",")","compatible","with","the","scikit-learn","preprocessing","API","with","methods",":","fit",",","transform",",","fit_transform","and","inverse_transform",".","Transformation","is","applied","to","each","`","series","`","before","training","the","forecaster",".","ColumnTransformers","are","not","allowed","since","they","do","not","have","inverse_transform","method",".","-","If","single","transformer",":","it","is","cloned","and","applied","to","all","series",".","-","If","`","dict","`","of","transformers",":","a","different","transformer","can","be","used","for","each","series",".","transformer_series_",":","dict","Dictionary","with","the","transformer","for","each","series",".","It","is","created","cloning","the","objects","in","`","transformer_series","`","and","is","used","internally","to","avoid","overwriting",".","transformer_exog",":","transformer","(","preprocessor",")","An","instance","of","a","transformer","(","preprocessor",")","compatible","with","the","scikit-learn","preprocessing","API",".","The","transformation","is","applied","to","`","exog","`","before","training","the","forecaster",".","`","inverse_transform","`","is","not","available","when","using","ColumnTransformers",".","weight_func",":","Callable",",","dict","Function","that","defines","the","individual","weights","for","each","sample","based","on","the","index",".","For","example",",","a","function","that","assigns","a","lower","weight","to","certain","dates",".","Ignored","if","`","regressor","`","does","not","have","the","argument","`","sample_weight","`","in","its","`","fit","`","method",".","See","Notes","section","for","more","details","on","the","use","of","the","weights",".","-","If","single","function",":","it","is","applied","to","all","series",".","-","If","`","dict","`","{","'series_column_name","'",":","Callable","}",":","a","different","function","can","be","used","for","each","series",",","a","weight","of","1","is","given","to","all","series","not","present","in","`","weight_func","`",".","weight_func_",":","dict","Dictionary","with","the","`","weight_func","`","for","each","series",".","It","is","created","cloning","the","objects","in","`","weight_func","`","and","is","used","internally","to","avoid","overwriting",".","source_code_weight_func",":","str",",","dict","Source","code","of","the","custom","function","(","s",")","used","to","create","weights",".","series_weights",":","dict","Weights","associated","with","each","series","{","'series_column_name","'",":","float","}",".","It","is","only","applied","if","the","`","regressor","`","used","accepts","`","sample_weight","`","in","its","`","fit","`","method",".","See","Notes","section","for","more","details","on","the","use","of","the","weights",".","-","If","a","`","dict","`","is","provided",",","a","weight","of","1","is","given","to","all","series","not","present","in","`","series_weights","`",".","-","If","`","None","`",",","all","levels","have","the","same","weight",".","series_weights_",":","dict","Weights","associated","with","each","series.It","is","created","as","a","clone","of","`","series_weights","`","and","is","used","internally","to","avoid","overwriting",".","window_size",":","int","Size","of","the","window","needed","by","`","fun_predictors","`","to","create","the","predictors",".","last_window",":","pandas","Series","Last","window","seen","by","the","forecaster","during","training",".","It","stores","the","values","needed","to","predict","the","next","`","step","`","immediately","after","the","training","data",".","index_type",":","type","Type","of","index","of","the","input","used","in","training",".","index_freq",":","str","Frequency","of","Index","of","the","input","used","in","training",".","index_values",":","pandas","Index","Values","of","Index","of","the","input","used","in","training",".","training_range",":","pandas","Index","First","and","last","values","of","index","of","the","data","used","during","training",".","included_exog",":","bool","If","the","forecaster","has","been","trained","using","exogenous","variable\/s",".","exog_type",":","type","Type","of","exogenous","variable\/s","used","in","training",".","exog_dtypes",":","dict","Type","of","each","exogenous","variable\/s","used","in","training",".","If","`","transformer_exog","`","is","used",",","the","dtypes","are","calculated","after","the","transformation",".","exog_col_names",":","list","Names","of","columns","of","`","exog","`","if","`","exog","`","used","in","training","was","a","pandas","DataFrame",".","series_col_names",":","list","Names","of","the","series","(","levels",")","used","during","training",".","X_train_col_names",":","list","Names","of","columns","of","the","matrix","created","internally","for","training",".","fit_kwargs",":","dict","Additional","arguments","to","be","passed","to","the","`","fit","`","method","of","the","regressor",".","in_sample_residuals",":","dict","Residuals","of","the","model","when","predicting","training","data",".","Only","stored","up","to","1000","values","in","the","form","`","{","level",":","residuals","}","`",".","If","`","transformer_series","`","is","not","`","None","`",",","residuals","are","stored","in","the","transformed","scale",".","out_sample_residuals",":","dict","Residuals","of","the","model","when","predicting","non-training","data",".","Only","stored","up","to","1000","values","in","the","form","`","{","level",":","residuals","}","`",".","If","`","transformer_series","`","is","not","`","None","`",",","residuals","are","assumed","to","be","in","the","transformed","scale",".","Use","`","set_out_sample_residuals","(",")","`","method","to","set","values",".","fitted",":","bool","Tag","to","identify","if","the","regressor","has","been","fitted","(","trained",")",".","creation_date",":","str","Date","of","creation",".","fit_date",":","str","Date","of","last","fit",".","skforecast_version",":","str","Version","of","skforecast","library","used","to","create","the","forecaster",".","python_version",":","str","Version","of","python","used","to","create","the","forecaster",".","forecaster_id",":","str",",","int","Name","used","as","an","identifier","of","the","forecaster",".","Notes","--","--","-","The","weights","are","used","to","control","the","influence","that","each","observation","has","on","the","training","of","the","model",".","`","ForecasterAutoregMultiseries","`","accepts","two","types","of","weights",".","If","the","two","types","of","weights","are","indicated",",","they","are","multiplied","to","create","the","final","weights",".","The","resulting","`","sample_weight","`","can","not","have","negative","values",".","-","`","series_weights","`",":","controls","the","relative","importance","of","each","series",".","If","a","series","has","twice","as","much","weight","as","the","others",",","the","observations","of","that","series","influence","the","training","twice","as","much",".","The","higher","the","weight","of","a","series","relative","to","the","others",",","the","more","the","model","will","focus","on","trying","to","learn","that","series",".","-","`","weight_func","`",":","controls","the","relative","importance","of","each","observation","according","to","its","index","value",".","For","example",",","a","function","that","assigns","a","lower","weight","to","certain","dates","."]
docstr: Predict n steps ahead. It is an iterative process in which, each prediction,
  is used as a predictor for the next step.
  
  Parameters
  ----------
  steps : int
      Number of future steps predicted.
  level : str
      Time series to be predicted.
  last_window : numpy ndarray
      Series values used to create the predictors (lags) needed in the 
      first iteration of the prediction (t + 1).
  exog : numpy ndarray, default `None`
      Exogenous variable/s included as predictor/s.
  
  Returns
  -------
  predictions : numpy ndarray
      Predicted values.
docstr_tok: ["Predict","n","steps","ahead",".","It","is","an","iterative","process","in","which",",","each","prediction",",","is","used","as","a","predictor","for","the","next","step",".","Parameters","--","--","--","--","--","steps",":","int","Number","of","future","steps","predicted",".","level",":","str","Time","series","to","be","predicted",".","last_window",":","numpy","ndarray","Series","values","used","to","create","the","predictors","(","lags",")","needed","in","the","first","iteration","of","the","prediction","(","t","+","1",")",".","exog",":","numpy","ndarray",",","default","`","None","`","Exogenous","variable\/s","included","as","predictor\/s",".","Returns","--","--","--","-","predictions",":","numpy","ndarray","Predicted","values","."]
code: def _recursive_predict(
      self,
      steps: int,
      level: str,
      last_window: np.ndarray,
      exog: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      """
      Predict n steps ahead. It is an iterative process in which, each prediction,
      is used as a predictor for the next step.
  
      Parameters
      ----------
      steps : int
          Number of future steps predicted.
      level : str
          Time series to be predicted.
      last_window : numpy ndarray
          Series values used to create the predictors (lags) needed in the
          first iteration of the prediction (t + 1).
      exog : numpy ndarray, default `None`
          Exogenous variable/s included as predictor/s.
  
      Returns
      -------
      predictions : numpy ndarray
          Predicted values.
  
      """
  
      predictions = np.full(shape=steps, fill_value=np.nan)
  
      for i in range(steps):
          X = self.fun_predictors(y=last_window).reshape(1, -1)
          if exog is not None:
              X = np.column_stack((X, exog[i,].reshape(1, -1)))
  
          levels_dummies = np.zeros(
              shape=(1, len(self.series_col_names)), dtype=float
          )
          levels_dummies[0][self.series_col_names.index(level)] = 1.0
  
          X = np.column_stack((X, levels_dummies.reshape(1, -1)))
  
          with warnings.catch_warnings():
              # Suppress scikit-learn warning: "X does not have valid feature names,
              # but NoOpTransformer was fitted with feature names".
              warnings.simplefilter("ignore")
              prediction = self.regressor.predict(X)
              predictions[i] = prediction.ravel()[0]
  
          # Update `last_window` values. The first position is discarded and
          # the new prediction is added at the end.
          last_window = np.append(last_window[1:], prediction)
  
      return predictions
  
imports: from typing import Union, Tuple, Optional, Callable
  import warnings
  import logging
  import sys
  import numpy
  import pandas
  import sklearn
  import sklearn.pipeline
  from sklearn.base import clone
  from sklearn.preprocessing import StandardScaler
  from copy import copy, deepcopy
  import inspect
  import skforecast
  from ..ForecasterBase import ForecasterBase
  from ..exceptions import IgnoredArgumentWarning
  from ..utils import initialize_weights
  from ..utils import check_select_fit_kwargs
  from ..utils import check_exog
  from ..utils import get_exog_dtypes
  from ..utils import check_exog_dtypes
  from ..utils import check_interval
  from ..utils import check_predict_input
  from ..utils import preprocess_y
  from ..utils import preprocess_last_window
  from ..utils import preprocess_exog
  from ..utils import expand_index
  from ..utils import transform_series
  from ..utils import transform_dataframe
label_desc: Use image node_id 6 for calling the ForecasterAutoregMultiSeriesCustom obj's underlying member method code with example usage: obj._recursive_predict(steps, level, last_window, exog) and returns: predictions