def test_get_estimator_multi_models(self):
        """Craft training data so that estimator_[i].predict(X) == i + 1"""

        def helper_check_overfitted_estimators(ts: TimeSeries, ocl: int):
            # since xgboost==2.1.0, the regular deterministic models have native multi output regression
            # -> we use a quantile likelihood to activate Darts' MultiOutputRegressor
            m = XGBModel(
                lags=3,
                output_chunk_length=ocl,
                multi_models=True,
                likelihood="quantile",
                quantiles=[0.5],
            )
            m.fit(ts)

            assert len(m.model.estimators_) == ocl * ts.width

            dummy_feats = np.array([[0, 0, 0] * ts.width])
            estimator_counter = 0
            for i in range(ocl):
                for j in range(ts.width):
                    sub_model = m.get_estimator(horizon=i, target_dim=j)
                    pred = sub_model.predict(dummy_feats)[0]
                    # sub-model is overfitted on the training series
                    assert np.abs(estimator_counter - pred) < 1e-2
                    estimator_counter += 1

        # univariate, one-sub model per step in output_chunk_length
        ocl = 3
        ts = TimeSeries.from_values(np.array([0, 0, 0, 0, 1, 2]).T)
        # estimators_[0] labels : [0]
        # estimators_[1] labels : [1]
        # estimators_[2] labels : [2]
        helper_check_overfitted_estimators(ts, ocl)

        # multivariate, one sub-model per component
        ocl = 1
        ts = TimeSeries.from_values(
            np.array([[0, 0, 0, 0], [0, 0, 0, 1], [0, 0, 0, 2]]).T
        )
        # estimators_[0] labels : [0]
        # estimators_[1] labels : [1]
        # estimators_[2] labels : [2]
        helper_check_overfitted_estimators(ts, ocl)

        # multivariate, one sub-model per position, per component
        ocl = 2
        ts = TimeSeries.from_values(
            np.array([
                [0, 0, 0, 0, 2],
                [0, 0, 0, 1, 3],
            ]).T
        )
        # estimators_[0] labels : [0]
        # estimators_[1] labels : [1]
        # estimators_[2] labels : [2]
        # estimators_[3] labels : [3]
        helper_check_overfitted_estimators(ts, ocl)
Craft training data so that estimator_[i].predict(X) == i + 1
darts/tests/models/forecasting/test_sklearn_models.py