def test_historical_forecasts_with_scaler_multiple_series(self, params):
        """Verify that the scaling in historical forecasts behave as expected when multiple series are used.

        The difference in behavior is caused by the difference in number of parameters when a scaler is fitted on
        a single series/multiple series with global_fit=True or with multplie series with global_fit=False.
        """
        retrain, global_fit = params
        # due to either of the argument, the scaler will have only one set of parameters
        unique_param_entry = retrain or global_fit
        ocl = 2
        hf_args = {
            "start": -ocl,
            "start_format": "position",
            "forecast_horizon": ocl,
            "last_points_only": False,
            "retrain": retrain,
            "verbose": False,
        }
        series = [self.sine_univariate1, self.sine_univariate2, self.sine_univariate3]

        model = LinearRegressionModel(lags=5, output_chunk_length=ocl)
        model.fit(series)

        def get_scaler(fit: bool):
            if fit:
                return Scaler(global_fit=global_fit).fit(series)
            else:
                return Scaler(global_fit=global_fit)

        # using all the series used to fit the scaler
        hf = model.historical_forecasts(
            **hf_args,
            series=series,
            data_transformers={"series": get_scaler(fit=True)},
        )
        manual_hf_0 = self.helper_manual_scaling_prediction(
            model,
            {"series": series[0]},
            {"series": get_scaler(fit=True)},
            retrain,
            -ocl,
            ocl,
            series_idx=None if unique_param_entry else 0,
        )
        manual_hf_1 = self.helper_manual_scaling_prediction(
            model,
            {"series": series[1]},
            {"series": get_scaler(fit=True)},
            retrain,
            -ocl,
            ocl,
            series_idx=None if unique_param_entry else 1,
        )
        manual_hf_2 = self.helper_manual_scaling_prediction(
            model,
            {"series": series[2]},
            {"series": get_scaler(fit=True)},
            retrain,
            -ocl,
            ocl,
            series_idx=None if unique_param_entry else 2,
        )
        self.helper_compare_hf(hf, [[manual_hf_0], [manual_hf_1], [manual_hf_2]])

        # scaler fit on 3 series, historical forecast only over the first one
        hf = model.historical_forecasts(
            **hf_args,
            series=series[0],
            data_transformers={"series": get_scaler(fit=True)},
        )
        manual_hf_0 = self.helper_manual_scaling_prediction(
            model,
            {"series": series[0]},
            {"series": get_scaler(fit=True)},
            retrain,
            -ocl,
            ocl,
        )
        self.helper_compare_hf(hf, [manual_hf_0])

        # scaler fit on 3 series, historical forecast only over the last one, causing a mismatch
        hf = model.historical_forecasts(
            **hf_args,
            series=series[2],
            data_transformers={"series": get_scaler(fit=True)},
        )
        # note that the series_idx is not specified, only the first transformer is used (instead of the 3rd)
        manual_hf_2 = self.helper_manual_scaling_prediction(
            model,
            {"series": series[2]},
            {"series": get_scaler(fit=True)},
            retrain,
            -ocl,
            ocl,
        )
        self.helper_compare_hf(hf, [manual_hf_2])

        # data_transformers are not pre-fitted
        if retrain:
            hf = model.historical_forecasts(
                **hf_args,
                series=series,
                data_transformers={"series": get_scaler(fit=False)},
            )
            manual_hf_0 = self.helper_manual_scaling_prediction(
                model,
                {"series": series[0]},
                {"series": get_scaler(fit=False)},
                retrain,
                -ocl,
                ocl,
            )
            manual_hf_1 = self.helper_manual_scaling_prediction(
                model,
                {"series": series[1]},
                {"series": get_scaler(fit=False)},
                retrain,
                -ocl,
                ocl,
            )
            manual_hf_2 = self.helper_manual_scaling_prediction(
                model,
                {"series": series[2]},
                {"series": get_scaler(fit=False)},
                retrain,
                -ocl,
                ocl,
            )
            self.helper_compare_hf(hf, [[manual_hf_0], [manual_hf_1], [manual_hf_2]])
Verify that the scaling in historical forecasts behave as expected when multiple series are used.

        The difference in behavior is caused by the difference in number of parameters when a scaler is fitted on
        a single series/multiple series with global_fit=True or with multplie series with global_fit=False.
        
darts/tests/utils/historical_forecasts/test_historical_forecasts.py