docstr: The `core.StatsForecast` class allows you to efficiently fit multiple `NeuralForecast` models
  for large sets of time series. It operates with pandas DataFrame `df` that identifies series
  and datestamps with the `unique_id` and `ds` columns. The `y` column denotes the target
  time series variable.
  
  Parameters
  ----------
  models : List[typing.Any]
      Instantiated `neuralforecast.models`
      see [collection here](https://nixtla.github.io/neuralforecast/models.html).
  freq : str or int
      Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.
  local_scaler_type : str, optional (default=None)
      Scaler to apply per-serie to all features before fitting, which is inverted after predicting.
      Can be 'standard', 'robust', 'robust-iqr', 'minmax' or 'boxcox'
  
  Returns
  -------
  self : NeuralForecast
      Returns instantiated `NeuralForecast` class.
docstr_tok: ["The","`","core.StatsForecast","`","class","allows","you","to","efficiently","fit","multiple","`","NeuralForecast","`","models","for","large","sets","of","time","series",".","It","operates","with","pandas","DataFrame","`","df","`","that","identifies","series","and","datestamps","with","the","`","unique_id","`","and","`","ds","`","columns",".","The","`","y","`","column","denotes","the","target","time","series","variable",".","Parameters","--","--","--","--","--","models",":","List","[","typing.Any","]","Instantiated","`","neuralforecast.models","`","see","[","collection","here","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/models.html",")",".","freq",":","str","or","int","Frequency","of","the","data",".","Must","be","a","valid","pandas","or","polars","offset","alias",",","or","an","integer",".","local_scaler_type",":","str",",","optional","(","default=None",")","Scaler","to","apply","per-serie","to","all","features","before","fitting",",","which","is","inverted","after","predicting",".","Can","be","'standard","'",",","'robust","'",",","'robust-iqr","'",",","'minmax","'","or","'boxcox'","Returns","--","--","--","-","self",":","NeuralForecast","Returns","instantiated","`","NeuralForecast","`","class","."]
code: def __init__(
      self,
      models: List[Any],
      freq: Union[str, int],
      local_scaler_type: Optional[str] = None,
  ):
      """
      The `core.StatsForecast` class allows you to efficiently fit multiple `NeuralForecast` models
      for large sets of time series. It operates with pandas DataFrame `df` that identifies series
      and datestamps with the `unique_id` and `ds` columns. The `y` column denotes the target
      time series variable.
  
      Parameters
      ----------
      models : List[typing.Any]
          Instantiated `neuralforecast.models`
          see [collection here](https://nixtla.github.io/neuralforecast/models.html).
      freq : str or int
          Frequency of the data. Must be a valid pandas or polars offset alias, or an integer.
      local_scaler_type : str, optional (default=None)
          Scaler to apply per-serie to all features before fitting, which is inverted after predicting.
          Can be 'standard', 'robust', 'robust-iqr', 'minmax' or 'boxcox'
  
      Returns
      -------
      self : NeuralForecast
          Returns instantiated `NeuralForecast` class.
      """
      assert all(
          model.h == models[0].h for model in models
      ), "All models should have the same horizon"
  
      self.h = models[0].h
      self.models_init = models
      self.freq = freq
      if (
          local_scaler_type is not None
          and local_scaler_type not in _type2scaler
      ):
          raise ValueError(
              f"scaler_type must be one of {_type2scaler.keys()}"
          )
      self.local_scaler_type = local_scaler_type
      self.scalers_: Dict[str, BaseTargetTransform]
  
      # Flags and attributes
      self._fitted = False
      self._reset_models()
  
imports: import os
  import pickle
  import warnings
  from copy import deepcopy
  from itertools import chain
  from typing import Any, Dict, List, Optional, Union
  import numpy
  import pandas
  import torch
  import utilsforecast.processing
  from utilsforecast.compat import DataFrame, Series, pl_DataFrame, pl_Series
  from utilsforecast.grouped_array import GroupedArray
  from utilsforecast.target_transforms import BaseTargetTransform, LocalBoxCox, LocalMinMaxScaler, LocalRobustScaler, LocalStandardScaler
  from utilsforecast.validation import validate_freq
  from .tsdataset import TimeSeriesDataset
  from neuralforecast.models import GRU, LSTM, RNN, TCN, DeepAR, DilatedRNN, MLP, NHITS, NBEATS, NBEATSx, TFT, VanillaTransformer, Informer, Autoformer, FEDformer, StemGNN, PatchTST, TimesNet
label_desc: Use image node_id 1 to create a new NeuralForecast object  with example: obj = NeuralForecast(models, freq, local_scaler_type)