class_docstr: Tests that data transformers inheriting from both `FittableDataTransformer` and
  `InvertibleDataTransformer` classes behave correctly when `global_fit` attribute
  is `True`.
class_docstr_tok: ["Tests","that","data","transformers","inheriting","from","both","`","FittableDataTransformer","`","and","`","InvertibleDataTransformer","`","classes","behave","correctly","when","`","global_fit","`","attribute","is","`","True","`","."]
docstr: Tests that invertible time-averaged mean subtraction transformation
  behaves correctly when `global_fit = False` and when `global_fit = True`.
docstr_tok: ["Tests","that","invertible","time-averaged","mean","subtraction","transformation","behaves","correctly","when","`","global_fit","=","False","`","and","when","`","global_fit","=","True","`","."]
code: def test_global_fitting(self):
      """
      Tests that invertible time-averaged mean subtraction transformation
      behaves correctly when `global_fit = False` and when `global_fit = True`.
      """
  
      series_1 = TimeSeries.from_values(np.ones((3, 2, 1)))
      series_2 = TimeSeries.from_values(2 * np.ones((3, 2, 1)))
  
      # Local fitting - subtracting mean of each series from itself should return
      # zero-valued series:
      transformer = self.DataTransformerMock(global_fit=False)
      transformed_1, transformed_2 = transformer.fit_transform(
          [series_1, series_2]
      )
      assert transformed_1 == TimeSeries.from_values(
          np.zeros((3, 2, 1))
      )
      assert transformed_2 == TimeSeries.from_values(
          np.zeros((3, 2, 1))
      )
      # Inverting transform should return input:
      untransformed_1, untransformed_2 = transformer.inverse_transform(
          [transformed_1, transformed_2]
      )
      assert untransformed_1 == series_1
      assert untransformed_2 == series_2
  
      # Global fitting - mean of `series_1` and `series_2` should be `1.5`, so
      # `series_1` values should be transformed to `-0.5` and `series_2` values
      # should be transformed to `1.5`:
      transformer = self.DataTransformerMock(global_fit=True)
      transformed_1, transformed_2 = transformer.fit_transform(
          [series_1, series_2]
      )
      assert transformed_1 == TimeSeries.from_values(
          -0.5 * np.ones((3, 2, 1))
      )
      assert transformed_2 == TimeSeries.from_values(
          0.5 * np.ones((3, 2, 1))
      )
      # Inverting transform should return input:
      untransformed_1, untransformed_2 = transformer.inverse_transform(
          [transformed_1, transformed_2]
      )
      assert untransformed_1 == series_1
      assert untransformed_2 == series_2
  
file_path: darts/darts/tests/dataprocessing/transformers/test_invertible_fittable_data_transformer.py
imports: from typing import Any, Mapping, Sequence, Union
  import numpy
  from darts import TimeSeries
  from darts.dataprocessing.transformers.fittable_data_transformer import FittableDataTransformer
  from darts.dataprocessing.transformers.invertible_data_transformer import InvertibleDataTransformer
  from darts.utils.timeseries_generation import constant_timeseries
label_desc: Use image node_id 1 for calling the TestGlobalFittableInvertibleDataTransformer obj's underlying member method code with example usage: obj.test_global_fitting() without return types