docstr: Data transformer to apply a custom function to a (sequence of) ``TimeSeries``
  (similar to calling :func:`TimeSeries.map()` on each series).
  
  The mapper takes care of parallelizing the operations on multiple series over
  multiple processors.
  
  Parameters
  ----------
  fn
      Either a function which takes a value and returns a value ie. `f(x) = y`
      Or a function which takes a value and its timestamp and returns a value ie. `f(timestamp, x) = y`.
  name
      A specific name for the transformer.
  n_jobs
      The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
      passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
      (sequential). Setting the parameter to `-1` means using all the available processors.
      Note: for a small amount of data, the parallelisation overhead could end up increasing the total
      required amount of time.
  verbose
      Optionally, whether to print operations progress
  
  Examples
  --------
  >>> import numpy as np
  >>> from darts import TimeSeries
  >>> from darts.dataprocessing.transformers import InvertibleMapper
  >>> series = TimeSeries.from_values(np.array([1e0, 1e1, 1e2, 1e3]))
  >>> transformer = InvertibleMapper(np.log10, lambda x: 10**x)
  >>> series_transformed = transformer.transform(series)
  >>> print(series_transformed)
  <TimeSeries (DataArray) (time: 4, component: 1, sample: 1)>
  array([[[0.]],
      [[1.]],
      [[2.]],
      [[3.]]])
  Coordinates:
  * time       (time) int64 0 1 2 3
  * component  (component) <U1 '0'
  Dimensions without coordinates: sample
docstr_tok: ["Data","transformer","to","apply","a","custom","function","to","a","(","sequence","of",")","``","TimeSeries","``","(","similar","to","calling",":","func",":","`","TimeSeries.map","(",")","`","on","each","series",")",".","The","mapper","takes","care","of","parallelizing","the","operations","on","multiple","series","over","multiple","processors",".","Parameters","--","--","--","--","--","fn","Either","a","function","which","takes","a","value","and","returns","a","value","ie",".","`","f","(","x",")","=","y","`","Or","a","function","which","takes","a","value","and","its","timestamp","and","returns","a","value","ie",".","`","f","(","timestamp",",","x",")","=","y","`",".","name","A","specific","name","for","the","transformer",".","n_jobs","The","number","of","jobs","to","run","in","parallel",".","Parallel","jobs","are","created","only","when","a","``","Sequence","[","TimeSeries","]","``","is","passed","as","input","to","a","method",",","parallelising","operations","regarding","different","``","TimeSeries","``",".","Defaults","to","`","1","`","(","sequential",")",".","Setting","the","parameter","to","`","-1","`","means","using","all","the","available","processors",".","Note",":","for","a","small","amount","of","data",",","the","parallelisation","overhead","could","end","up","increasing","the","total","required","amount","of","time",".","verbose","Optionally",",","whether","to","print","operations","progress","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","darts","import","TimeSeries",">",">",">","from","darts.dataprocessing.transformers","import","InvertibleMapper",">",">",">","series","=","TimeSeries.from_values","(","np.array","(","[","1e0",",","1e1",",","1e2",",","1e3","]",")",")",">",">",">","transformer","=","InvertibleMapper","(","np.log10",",","lambda","x",":","10","*","*","x",")",">",">",">","series_transformed","=","transformer.transform","(","series",")",">",">",">","print","(","series_transformed",")","<","TimeSeries","(","DataArray",")","(","time",":","4",",","component",":","1",",","sample",":","1",")",">","array","(","[","[","[","0",".","]","]",",","[","[","1",".","]","]",",","[","[","2",".","]","]",",","[","[","3",".","]","]","]",")","Coordinates",":","*","time","(","time",")","int64","0","1","2","3","*","component","(","component",")","<","U1","'","0'","Dimensions","without","coordinates",":","sample"]
code: def __init__(
      self,
      fn: Union[
          Callable[[np.number], np.number],
          Callable[[pd.Timestamp, np.number], np.number],
      ],
      name: str = "Mapper",
      n_jobs: int = 1,
      verbose: bool = False,
  ):
      """
      Data transformer to apply a custom function to a (sequence of) ``TimeSeries``
      (similar to calling :func:`TimeSeries.map()` on each series).
  
      The mapper takes care of parallelizing the operations on multiple series over
      multiple processors.
  
      Parameters
      ----------
      fn
          Either a function which takes a value and returns a value ie. `f(x) = y`
          Or a function which takes a value and its timestamp and returns a value ie. `f(timestamp, x) = y`.
      name
          A specific name for the transformer.
      n_jobs
          The number of jobs to run in parallel. Parallel jobs are created only when a ``Sequence[TimeSeries]`` is
          passed as input to a method, parallelising operations regarding different ``TimeSeries``. Defaults to `1`
          (sequential). Setting the parameter to `-1` means using all the available processors.
          Note: for a small amount of data, the parallelisation overhead could end up increasing the total
          required amount of time.
      verbose
          Optionally, whether to print operations progress
  
      Examples
      --------
      >>> import numpy as np
      >>> from darts import TimeSeries
      >>> from darts.dataprocessing.transformers import InvertibleMapper
      >>> series = TimeSeries.from_values(np.array([1e0, 1e1, 1e2, 1e3]))
      >>> transformer = InvertibleMapper(np.log10, lambda x: 10**x)
      >>> series_transformed = transformer.transform(series)
      >>> print(series_transformed)
      <TimeSeries (DataArray) (time: 4, component: 1, sample: 1)>
      array([[[0.]],
          [[1.]],
          [[2.]],
          [[3.]]])
      Coordinates:
      * time       (time) int64 0 1 2 3
      * component  (component) <U1 '0'
      Dimensions without coordinates: sample
      """
      # Define fixed params (i.e. attributes defined before calling `super().__init__`):
      self._fn = fn
      super().__init__(name=name, n_jobs=n_jobs, verbose=verbose)
  
file_path: darts/darts/dataprocessing/transformers/mappers.py
imports: from typing import Any, Callable, Mapping, Union
  import numpy
  import pandas
  from darts.logging import get_logger
  from darts.timeseries import TimeSeries
  from .base_data_transformer import BaseDataTransformer
  from .invertible_data_transformer import InvertibleDataTransformer
label_desc: Use image node_id 1 to create a new Mapper object from inherited base classes: BaseDataTransformer with example: obj = Mapper(fn, name, n_jobs, verbose)