docstr: The function that will be applied to each series when :func:`fit` is called.
  
  If the `global_fit` attribute is set to `False`, then `ts_fit` should accept a `TimeSeries` as a first
  argument and return a set of parameters that are fitted to this individual `TimeSeries`. Conversely, if the
  `global_fit` attribute is set to `True`, then `ts_fit` should accept a `Sequence[TimeSeries]` and
  return a set of parameters that are fitted to *all* of the provided `TimeSeries`. All these parameters will
  be stored in ``self._fitted_params``, which can be later used during the transformation step.
  
  Regardless of whether the `global_fit` attribute is set to `True` or `False`, `ts_fit` should also accept
  a dictionary of fixed parameter values as a second argument (i.e. `params['fixed'] contains the fixed
  parameters of the data transformer).
  
  Any additional positional and/or keyword arguments passed to the `fit` method will be passed as
  positional/keyword arguments to `ts_fit`.
  
  This method is not implemented in the base class and must be implemented in the deriving classes.
  
  If more parameters are added as input in the derived classes, :func:`_fit_iterator()`
  should be redefined accordingly, to yield the necessary arguments to this function (See
  :func:`_fit_iterator()` for further details)
  
  Parameters
  ----------
  series (Union[TimeSeries, Sequence[TimeSeries]])
      `TimeSeries` against which the scaler will be fit.
  
  Notes
  -----
  This method is designed to be a static method instead of instance methods to allow an efficient
  parallelisation also when the scaler instance is storing a non-negligible amount of data. Using instance
  methods would imply copying the instance's data through multiple processes, which can easily introduce a
  bottleneck and nullify parallelisation benefits.
docstr_tok: ["The","function","that","will","be","applied","to","each","series","when",":","func",":","`","fit","`","is","called",".","If","the","`","global_fit","`","attribute","is","set","to","`","False","`",",","then","`","ts_fit","`","should","accept","a","`","TimeSeries","`","as","a","first","argument","and","return","a","set","of","parameters","that","are","fitted","to","this","individual","`","TimeSeries","`",".","Conversely",",","if","the","`","global_fit","`","attribute","is","set","to","`","True","`",",","then","`","ts_fit","`","should","accept","a","`","Sequence","[","TimeSeries","]","`","and","return","a","set","of","parameters","that","are","fitted","to","*","all","*","of","the","provided","`","TimeSeries","`",".","All","these","parameters","will","be","stored","in","``","self._fitted_params","``",",","which","can","be","later","used","during","the","transformation","step",".","Regardless","of","whether","the","`","global_fit","`","attribute","is","set","to","`","True","`","or","`","False","`",",","`","ts_fit","`","should","also","accept","a","dictionary","of","fixed","parameter","values","as","a","second","argument","(","i.e",".","`","params","[","'fixed","'","]","contains","the","fixed","parameters","of","the","data","transformer",")",".","Any","additional","positional","and\/or","keyword","arguments","passed","to","the","`","fit","`","method","will","be","passed","as","positional\/keyword","arguments","to","`","ts_fit","`",".","This","method","is","not","implemented","in","the","base","class","and","must","be","implemented","in","the","deriving","classes",".","If","more","parameters","are","added","as","input","in","the","derived","classes",",",":","func",":","`","_fit_iterator","(",")","`","should","be","redefined","accordingly",",","to","yield","the","necessary","arguments","to","this","function","(","See",":","func",":","`","_fit_iterator","(",")","`","for","further","details",")","Parameters","--","--","--","--","--","series","(","Union","[","TimeSeries",",","Sequence","[","TimeSeries","]","]",")","`","TimeSeries","`","against","which","the","scaler","will","be","fit",".","Notes","--","--","-","This","method","is","designed","to","be","a","static","method","instead","of","instance","methods","to","allow","an","efficient","parallelisation","also","when","the","scaler","instance","is","storing","a","non-negligible","amount","of","data",".","Using","instance","methods","would","imply","copying","the","instance","'s","data","through","multiple","processes",",","which","can","easily","introduce","a","bottleneck","and","nullify","parallelisation","benefits","."]
code: def ts_fit(
      series: Union[TimeSeries, Sequence[TimeSeries]],
      params: Mapping[str, Any],
      *args,
      **kwargs,
  ):
      """The function that will be applied to each series when :func:`fit` is called.
  
      If the `global_fit` attribute is set to `False`, then `ts_fit` should accept a `TimeSeries` as a first
      argument and return a set of parameters that are fitted to this individual `TimeSeries`. Conversely, if the
      `global_fit` attribute is set to `True`, then `ts_fit` should accept a `Sequence[TimeSeries]` and
      return a set of parameters that are fitted to *all* of the provided `TimeSeries`. All these parameters will
      be stored in ``self._fitted_params``, which can be later used during the transformation step.
  
      Regardless of whether the `global_fit` attribute is set to `True` or `False`, `ts_fit` should also accept
      a dictionary of fixed parameter values as a second argument (i.e. `params['fixed'] contains the fixed
      parameters of the data transformer).
  
      Any additional positional and/or keyword arguments passed to the `fit` method will be passed as
      positional/keyword arguments to `ts_fit`.
  
      This method is not implemented in the base class and must be implemented in the deriving classes.
  
      If more parameters are added as input in the derived classes, :func:`_fit_iterator()`
      should be redefined accordingly, to yield the necessary arguments to this function (See
      :func:`_fit_iterator()` for further details)
  
      Parameters
      ----------
      series (Union[TimeSeries, Sequence[TimeSeries]])
          `TimeSeries` against which the scaler will be fit.
  
      Notes
      -----
      This method is designed to be a static method instead of instance methods to allow an efficient
      parallelisation also when the scaler instance is storing a non-negligible amount of data. Using instance
      methods would imply copying the instance's data through multiple processes, which can easily introduce a
      bottleneck and nullify parallelisation benefits.
      """
      pass
  
file_path: darts/darts/dataprocessing/transformers/fittable_data_transformer.py
imports: from abc import abstractmethod
  from typing import Any, Generator, List, Mapping, Optional, Sequence, Union
  import numpy
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not
  from darts.utils import _build_tqdm_iterator, _parallel_apply
  from .base_data_transformer import BaseDataTransformer
label_desc: Use image node_id 2 for calling the FittableDataTransformer obj's underlying member method code with example usage: obj.ts_fit(series, params) without return types