docstr: Fits transformer to a (sequence of) `TimeSeries` by calling the user-implemented `ts_fit` method.
  
  The fitted parameters returned by `ts_fit` are stored in the ``self._fitted_params`` attribute.
  If a `Sequence[TimeSeries]` is passed as the `series` data, then one of two outcomes will occur:
      1. If the `global_fit` attribute was set to `False`, then a different set of parameters will be
      individually fitted to each `TimeSeries` in the `Sequence`. In this case, this function automatically
      parallelises this fitting process over all of the multiple `TimeSeries` that have been passed.
      2. If the `global_fit` attribute was set to `True`, then all of the `TimeSeries` objects will be used
      fit a single set of parameters.
  
  Parameters
  ----------
  series
      (sequence of) series to fit the transformer on.
  args
      Additional positional arguments for the :func:`ts_fit` method
  component_mask : Optional[np.ndarray] = None
      Optionally, a 1-D boolean np.ndarray of length ``series.n_components`` that specifies which
      components of the underlying `series` the transform should be fitted to.
  kwargs
      Additional keyword arguments for the :func:`ts_fit` method
  
  Returns
  -------
  FittableDataTransformer
      Fitted transformer.
docstr_tok: ["Fits","transformer","to","a","(","sequence","of",")","`","TimeSeries","`","by","calling","the","user-implemented","`","ts_fit","`","method",".","The","fitted","parameters","returned","by","`","ts_fit","`","are","stored","in","the","``","self._fitted_params","``","attribute",".","If","a","`","Sequence","[","TimeSeries","]","`","is","passed","as","the","`","series","`","data",",","then","one","of","two","outcomes","will","occur",":","1",".","If","the","`","global_fit","`","attribute","was","set","to","`","False","`",",","then","a","different","set","of","parameters","will","be","individually","fitted","to","each","`","TimeSeries","`","in","the","`","Sequence","`",".","In","this","case",",","this","function","automatically","parallelises","this","fitting","process","over","all","of","the","multiple","`","TimeSeries","`","that","have","been","passed",".","2",".","If","the","`","global_fit","`","attribute","was","set","to","`","True","`",",","then","all","of","the","`","TimeSeries","`","objects","will","be","used","fit","a","single","set","of","parameters",".","Parameters","--","--","--","--","--","series","(","sequence","of",")","series","to","fit","the","transformer","on",".","args","Additional","positional","arguments","for","the",":","func",":","`","ts_fit","`","method","component_mask",":","Optional","[","np.ndarray","]","=","None","Optionally",",","a","1-D","boolean","np.ndarray","of","length","``","series.n_components","``","that","specifies","which","components","of","the","underlying","`","series","`","the","transform","should","be","fitted","to",".","kwargs","Additional","keyword","arguments","for","the",":","func",":","`","ts_fit","`","method","Returns","--","--","--","-","FittableDataTransformer","Fitted","transformer","."]
code: def fit(
      self,
      series: Union[TimeSeries, Sequence[TimeSeries]],
      *args,
      component_mask: Optional[np.array] = None,
      **kwargs,
  ) -> "FittableDataTransformer":
      """Fits transformer to a (sequence of) `TimeSeries` by calling the user-implemented `ts_fit` method.
  
      The fitted parameters returned by `ts_fit` are stored in the ``self._fitted_params`` attribute.
      If a `Sequence[TimeSeries]` is passed as the `series` data, then one of two outcomes will occur:
          1. If the `global_fit` attribute was set to `False`, then a different set of parameters will be
          individually fitted to each `TimeSeries` in the `Sequence`. In this case, this function automatically
          parallelises this fitting process over all of the multiple `TimeSeries` that have been passed.
          2. If the `global_fit` attribute was set to `True`, then all of the `TimeSeries` objects will be used
          fit a single set of parameters.
  
      Parameters
      ----------
      series
          (sequence of) series to fit the transformer on.
      args
          Additional positional arguments for the :func:`ts_fit` method
      component_mask : Optional[np.ndarray] = None
          Optionally, a 1-D boolean np.ndarray of length ``series.n_components`` that specifies which
          components of the underlying `series` the transform should be fitted to.
      kwargs
          Additional keyword arguments for the :func:`ts_fit` method
  
      Returns
      -------
      FittableDataTransformer
          Fitted transformer.
      """
      self._fit_called = True
  
      desc = f"Fitting ({self._name})"
  
      if isinstance(series, TimeSeries):
          data = [series]
      else:
          data = series
  
      if self._mask_components:
          data = [
              self.apply_component_mask(
                  ts, component_mask, return_ts=True
              )
              for ts in data
          ]
      else:
          kwargs["component_mask"] = component_mask
  
      params_iterator = self._get_params(
          n_timeseries=len(data), calling_fit=True
      )
      fit_iterator = (
          zip(data, params_iterator)
          if not self._global_fit
          else zip([data], params_iterator)
      )
      n_jobs = len(data) if not self._global_fit else 1
      input_iterator = _build_tqdm_iterator(
          fit_iterator, verbose=self._verbose, desc=desc, total=n_jobs
      )
  
      self._fitted_params = _parallel_apply(
          input_iterator,
          self.__class__.ts_fit,
          self._n_jobs,
          args,
          kwargs,
      )
  
      return self
  
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 3 for calling the FittableDataTransformer obj's underlying member method code with example usage: obj.fit(series) and returns: self