code: def test_dummy_regressor_mean_prediction_endogenous_only(
      fh, window_length, strategy, scitype
  ):
      """Test dummy regressor mean prediction endogenous_only.
  
      The DummyRegressor ignores the input feature data X, hence we can use it for testing
      reduction from forecasting to both tabular and time series regression. The
      DummyRegressor also supports the 'multioutput' strategy.
      """
      y = make_forecasting_problem()
      fh = check_fh(fh)
      y_train, y_test = temporal_train_test_split(y, fh=fh)
  
      regressor = DummyRegressor(strategy="mean")
      forecaster = make_reduction(
          regressor,
          scitype=scitype,
          window_length=window_length,
          strategy=strategy,
      )
      forecaster.fit(y_train, fh=fh)
      actual = forecaster.predict()
  
      if strategy == "recursive":
          # For the recursive strategy, we always use the first-step ahead as the
          # target vector in the regression problem during training, regardless of the
          # actual forecasting horizon.
          effective_window_length = window_length
      else:
          # For the other strategies, we split the data taking into account the steps
          # ahead we want to predict.
          effective_window_length = window_length + max(fh) - 1
  
      # In the sliding-window transformation, the first values of the target series
      # make up the first window and are not used in the transformed target vector. So
      # the expected result should be the mean of the remaining values.
      expected = np.mean(y_train[effective_window_length:])
      np.testing.assert_array_almost_equal(actual, expected)
  
imports: import numpy
  import pandas
  import pytest
  from sklearn.base import BaseEstimator, RegressorMixin
  from sklearn.dummy import DummyRegressor
  from sklearn.linear_model import LinearRegression
  from sklearn.pipeline import make_pipeline
  from sktime.datasets import load_airline
  from sktime.forecasting.base import ForecastingHorizon
  from sktime.forecasting.compose import DirectTabularRegressionForecaster, DirectTimeSeriesRegressionForecaster, DirRecTabularRegressionForecaster, DirRecTimeSeriesRegressionForecaster, MultioutputTabularRegressionForecaster, MultioutputTimeSeriesRegressionForecaster, RecursiveTabularRegressionForecaster, RecursiveTimeSeriesRegressionForecaster, make_reduction
  from sktime.forecasting.compose._reduce import _sliding_window_transform
  from sktime.forecasting.tests._config import TEST_OOS_FHS, TEST_WINDOW_LENGTHS_INT
  from sktime.performance_metrics.forecasting import mean_absolute_percentage_error
  from sktime.regression.base import BaseRegressor
  from sktime.regression.interval_based import TimeSeriesForestRegressor
  from sktime.split import SlidingWindowSplitter, temporal_train_test_split
  from sktime.split.tests.test_split import _get_windows
  from sktime.transformations.panel.reduce import Tabularizer
  from sktime.utils._testing.forecasting import make_forecasting_problem
  from sktime.utils.validation.forecasting import check_fh
label_desc: Use image node_id 8 for calling a global function with example usage: test_dummy_regressor_mean_prediction_endogenous_only(fh, window_length, strategy, scitype) without return types