docstr: The function that will be applied to each series when :func:`transform()` is called.
  
  This method is not implemented in the base class and must be implemented in the deriving classes.
  
  The function must take as first argument a ``TimeSeries`` object and, as a second argument, a
  dictionary containing the fixed and/or fitted parameters of the transformation; this function
  should then return a transformed ``TimeSeries`` object.
  
  The `params` dictionary *can* contain up to two keys:
      1. `params['fixed']` stores the fixed parameters of the transformation (i.e. attributed
      defined in the `__init__` method of the child-most class *before* `super().__init__` is called);
      `params['fixed']` is a dictionary itself, whose keys are the names of the fixed parameter
      attributes. For example, if `_my_fixed_param` is defined as an attribute in the child-most
      class, then this fixed parameter value can be accessed through `params['fixed']['_my_fixed_param']`.
      2. If the transform inherits from the :class:`.FittableDataTransformer` class, then `params['fitted']`
      will store the fitted parameters of the transformation; the fitted parameters are simply the output(s)
      returned by the `ts_fit` function, whatever those output(s) may be. See :class:`.FittableDataTransformer`
      for further details about fitted parameters.
  
  Any positional/keyword argument supplied to the `transform` method are passed as positional/keyword arguments
  to `ts_transform`; hence, `ts_transform` should also accept `*args` and/or `**kwargs` if positional/keyword
  arguments are passed to `transform`. Note that if the `mask_components` attribute of `BaseDataTransformer`
  is set to `False`, then the `component_mask` provided to `transform` will be passed as an additional keyword
  argument to `ts_transform`.
  
  The `BaseDataTransformer` class includes some helper methods which may prove useful when implementing a
  `ts_transform` function:
      1. The `apply_component_mask` and `unapply_component_mask` methods, which apply and 'unapply'
      `component_mask`s to a `TimeSeries` respectively; these methods are automatically called in `transform`
      if the `mask_component` attribute of `BaseDataTransformer` is set to `True`, but you may want to manually
      call them if you set `mask_components` to `False` and wish to manually specify how `component_mask`s are
      applied to a `TimeSeries`.
      2. The `stack_samples` method, which stacks all the samples in a `TimeSeries` along
      the component axis, so that the `TimeSeries` goes from shape `(n_timesteps, n_components, n_samples)` to
      shape `(n_timesteps, n_components * n_samples)`. This stacking is useful if a pointwise transform is being
      implemented (i.e. transforming the value at time `t` depends only on the value of the series at that
      time `t`). Once transformed, the stacked `TimeSeries` can be 'unstacked' using the `unstack_samples` method.
  
  Parameters
  ----------
  series
      series to be transformed.
  params
      Dictionary containing the parameters of the transformation function. Fixed parameters
      (i.e. attributes defined in the child-most class of the transformation prior to
      calling `super.__init__()`) are stored under the `'fixed'` key. If the transformation
      inherits from the `FittableDataTransformer` class, then the fitted parameters of the
      transformation (i.e. the values returned by `ts_fit`) are stored under the
      `'fitted'` key.
  args
      Any poisitional arguments provided in addition to `series` when
  kwargs
      Any additional keyword arguments provided to `transform`. Note that if the `mask_component`
      attribute of `BaseDataTransformer` is set to `False`, then `component_mask` will
      be passed as a keyword argument.
  
  Notes
  -----
  This method is designed to be a static method instead of instance method 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",":","`","transform","(",")","`","is","called",".","This","method","is","not","implemented","in","the","base","class","and","must","be","implemented","in","the","deriving","classes",".","The","function","must","take","as","first","argument","a","``","TimeSeries","``","object","and",",","as","a","second","argument",",","a","dictionary","containing","the","fixed","and\/or","fitted","parameters","of","the","transformation",";","this","function","should","then","return","a","transformed","``","TimeSeries","``","object",".","The","`","params","`","dictionary","*","can","*","contain","up","to","two","keys",":","1",".","`","params","[","'fixed","'","]","`","stores","the","fixed","parameters","of","the","transformation","(","i.e",".","attributed","defined","in","the","`","__init__","`","method","of","the","child-most","class","*","before","*","`","super","(",")",".__init__","`","is","called",")",";","`","params","[","'fixed","'","]","`","is","a","dictionary","itself",",","whose","keys","are","the","names","of","the","fixed","parameter","attributes",".","For","example",",","if","`","_my_fixed_param","`","is","defined","as","an","attribute","in","the","child-most","class",",","then","this","fixed","parameter","value","can","be","accessed","through","`","params","[","'fixed","'","]","[","'_my_fixed_param","'","]","`",".","2",".","If","the","transform","inherits","from","the",":","class",":","`",".FittableDataTransformer","`","class",",","then","`","params","[","'fitted","'","]","`","will","store","the","fitted","parameters","of","the","transformation",";","the","fitted","parameters","are","simply","the","output","(","s",")","returned","by","the","`","ts_fit","`","function",",","whatever","those","output","(","s",")","may","be",".","See",":","class",":","`",".FittableDataTransformer","`","for","further","details","about","fitted","parameters",".","Any","positional\/keyword","argument","supplied","to","the","`","transform","`","method","are","passed","as","positional\/keyword","arguments","to","`","ts_transform","`",";","hence",",","`","ts_transform","`","should","also","accept","`","*","args","`","and\/or","`","*","*","kwargs","`","if","positional\/keyword","arguments","are","passed","to","`","transform","`",".","Note","that","if","the","`","mask_components","`","attribute","of","`","BaseDataTransformer","`","is","set","to","`","False","`",",","then","the","`","component_mask","`","provided","to","`","transform","`","will","be","passed","as","an","additional","keyword","argument","to","`","ts_transform","`",".","The","`","BaseDataTransformer","`","class","includes","some","helper","methods","which","may","prove","useful","when","implementing","a","`","ts_transform","`","function",":","1",".","The","`","apply_component_mask","`","and","`","unapply_component_mask","`","methods",",","which","apply","and","'unapply'","`","component_mask","`","s","to","a","`","TimeSeries","`","respectively",";","these","methods","are","automatically","called","in","`","transform","`","if","the","`","mask_component","`","attribute","of","`","BaseDataTransformer","`","is","set","to","`","True","`",",","but","you","may","want","to","manually","call","them","if","you","set","`","mask_components","`","to","`","False","`","and","wish","to","manually","specify","how","`","component_mask","`","s","are","applied","to","a","`","TimeSeries","`",".","2",".","The","`","stack_samples","`","method",",","which","stacks","all","the","samples","in","a","`","TimeSeries","`","along","the","component","axis",",","so","that","the","`","TimeSeries","`","goes","from","shape","`","(","n_timesteps",",","n_components",",","n_samples",")","`","to","shape","`","(","n_timesteps",",","n_components","*","n_samples",")","`",".","This","stacking","is","useful","if","a","pointwise","transform","is","being","implemented","(","i.e",".","transforming","the","value","at","time","`","t","`","depends","only","on","the","value","of","the","series","at","that","time","`","t","`",")",".","Once","transformed",",","the","stacked","`","TimeSeries","`","can","be","'unstacked","'","using","the","`","unstack_samples","`","method",".","Parameters","--","--","--","--","--","series","series","to","be","transformed",".","params","Dictionary","containing","the","parameters","of","the","transformation","function",".","Fixed","parameters","(","i.e",".","attributes","defined","in","the","child-most","class","of","the","transformation","prior","to","calling","`","super.__init__","(",")","`",")","are","stored","under","the","`","'fixed","'","`","key",".","If","the","transformation","inherits","from","the","`","FittableDataTransformer","`","class",",","then","the","fitted","parameters","of","the","transformation","(","i.e",".","the","values","returned","by","`","ts_fit","`",")","are","stored","under","the","`","'fitted","'","`","key",".","args","Any","poisitional","arguments","provided","in","addition","to","`","series","`","when","kwargs","Any","additional","keyword","arguments","provided","to","`","transform","`",".","Note","that","if","the","`","mask_component","`","attribute","of","`","BaseDataTransformer","`","is","set","to","`","False","`",",","then","`","component_mask","`","will","be","passed","as","a","keyword","argument",".","Notes","--","--","-","This","method","is","designed","to","be","a","static","method","instead","of","instance","method","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_transform(
      series: TimeSeries, params: Mapping[str, Any]
  ) -> TimeSeries:
      """The function that will be applied to each series when :func:`transform()` is called.
  
      This method is not implemented in the base class and must be implemented in the deriving classes.
  
      The function must take as first argument a ``TimeSeries`` object and, as a second argument, a
      dictionary containing the fixed and/or fitted parameters of the transformation; this function
      should then return a transformed ``TimeSeries`` object.
  
      The `params` dictionary *can* contain up to two keys:
          1. `params['fixed']` stores the fixed parameters of the transformation (i.e. attributed
          defined in the `__init__` method of the child-most class *before* `super().__init__` is called);
          `params['fixed']` is a dictionary itself, whose keys are the names of the fixed parameter
          attributes. For example, if `_my_fixed_param` is defined as an attribute in the child-most
          class, then this fixed parameter value can be accessed through `params['fixed']['_my_fixed_param']`.
          2. If the transform inherits from the :class:`.FittableDataTransformer` class, then `params['fitted']`
          will store the fitted parameters of the transformation; the fitted parameters are simply the output(s)
          returned by the `ts_fit` function, whatever those output(s) may be. See :class:`.FittableDataTransformer`
          for further details about fitted parameters.
  
      Any positional/keyword argument supplied to the `transform` method are passed as positional/keyword arguments
      to `ts_transform`; hence, `ts_transform` should also accept `*args` and/or `**kwargs` if positional/keyword
      arguments are passed to `transform`. Note that if the `mask_components` attribute of `BaseDataTransformer`
      is set to `False`, then the `component_mask` provided to `transform` will be passed as an additional keyword
      argument to `ts_transform`.
  
      The `BaseDataTransformer` class includes some helper methods which may prove useful when implementing a
      `ts_transform` function:
          1. The `apply_component_mask` and `unapply_component_mask` methods, which apply and 'unapply'
          `component_mask`s to a `TimeSeries` respectively; these methods are automatically called in `transform`
          if the `mask_component` attribute of `BaseDataTransformer` is set to `True`, but you may want to manually
          call them if you set `mask_components` to `False` and wish to manually specify how `component_mask`s are
          applied to a `TimeSeries`.
          2. The `stack_samples` method, which stacks all the samples in a `TimeSeries` along
          the component axis, so that the `TimeSeries` goes from shape `(n_timesteps, n_components, n_samples)` to
          shape `(n_timesteps, n_components * n_samples)`. This stacking is useful if a pointwise transform is being
          implemented (i.e. transforming the value at time `t` depends only on the value of the series at that
          time `t`). Once transformed, the stacked `TimeSeries` can be 'unstacked' using the `unstack_samples` method.
  
      Parameters
      ----------
      series
          series to be transformed.
      params
          Dictionary containing the parameters of the transformation function. Fixed parameters
          (i.e. attributes defined in the child-most class of the transformation prior to
          calling `super.__init__()`) are stored under the `'fixed'` key. If the transformation
          inherits from the `FittableDataTransformer` class, then the fitted parameters of the
          transformation (i.e. the values returned by `ts_fit`) are stored under the
          `'fitted'` key.
      args
          Any poisitional arguments provided in addition to `series` when
      kwargs
          Any additional keyword arguments provided to `transform`. Note that if the `mask_component`
          attribute of `BaseDataTransformer` is set to `False`, then `component_mask` will
          be passed as a keyword argument.
  
      Notes
      -----
      This method is designed to be a static method instead of instance method 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
  
imports: from abc import ABC, abstractmethod
  from typing import Any, Generator, List, Mapping, Optional, Sequence, Union
  import numpy
  import xarray
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not
  from darts.utils import _build_tqdm_iterator, _parallel_apply
label_desc: Use image node_id 4 for calling the BaseDataTransformer obj's underlying member method code with example usage: obj.ts_transform(series, params) without return types