code: def test_results_output_bayesian_search_skopt_ForecasterAutoreg_with_mocked():  # pragma: no cover
      """
      Test output of _bayesian_search_skopt in ForecasterAutoreg with mocked
      (mocked done in Skforecast v0.4.3).
      """
  
      forecaster = ForecasterAutoreg(
          regressor=RandomForestRegressor(random_state=123),
          lags=2,  # Placeholder, the value will be overwritten
      )
  
      steps = 3
      n_validation = 12
      y_train = y[:-n_validation]
      lags_grid = [2, 4]
      search_space = {
          "n_estimators": Integer(
              10, 20, "uniform", name="n_estimators"
          ),
          "min_samples_leaf": Real(
              1.0, 3.7, "log-uniform", name="min_samples_leaf"
          ),
          "max_features": Categorical(
              ["log2", "sqrt"], name="max_features"
          ),
      }
  
      results = _bayesian_search_skopt(
          forecaster=forecaster,
          y=y,
          lags_grid=lags_grid,
          search_space=search_space,
          steps=steps,
          metric="mean_absolute_error",
          refit=True,
          initial_train_size=len(y_train),
          fixed_train_size=True,
          n_trials=10,
          random_state=123,
          return_best=False,
          verbose=False,
      )[0]
  
      expected_results = pd.DataFrame(
          {
              "lags": [
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
                  [1, 2, 3, 4],
              ],
              "params": [
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.7516926954624357,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.901317408816101,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.134928323868993,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.272179337814922,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 12,
                      "min_samples_leaf": 2.481767480132848,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 16,
                      "min_samples_leaf": 1.778913732091379,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.7503011299565185,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 15,
                      "min_samples_leaf": 2.634132917484797,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.3551239865216638,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 12,
                      "min_samples_leaf": 3.6423411901787532,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.7516926954624357,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.901317408816101,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.134928323868993,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.272179337814922,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 12,
                      "min_samples_leaf": 2.481767480132848,
                      "max_features": "sqrt",
                  },
                  {
                      "n_estimators": 16,
                      "min_samples_leaf": 1.778913732091379,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 17,
                      "min_samples_leaf": 1.7503011299565185,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 15,
                      "min_samples_leaf": 2.634132917484797,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 14,
                      "min_samples_leaf": 2.3551239865216638,
                      "max_features": "log2",
                  },
                  {
                      "n_estimators": 12,
                      "min_samples_leaf": 3.6423411901787532,
                      "max_features": "sqrt",
                  },
              ],
              "mean_absolute_error": np.array(
                  [
                      0.21433589521377985,
                      0.21433589521377985,
                      0.21661388810185186,
                      0.21661388810185186,
                      0.21685103020640437,
                      0.2152253922034143,
                      0.21433589521377985,
                      0.21479600790277778,
                      0.21661388810185186,
                      0.21685103020640437,
                      0.20997867726211075,
                      0.20997867726211075,
                      0.20952958306022407,
                      0.20952958306022407,
                      0.20980140118464055,
                      0.21045872919117656,
                      0.20997867726211075,
                      0.20840381228758173,
                      0.20952958306022407,
                      0.20980140118464055,
                  ]
              ),
              "n_estimators": np.array(
                  [
                      17,
                      17,
                      14,
                      14,
                      12,
                      16,
                      17,
                      15,
                      14,
                      12,
                      17,
                      17,
                      14,
                      14,
                      12,
                      16,
                      17,
                      15,
                      14,
                      12,
                  ]
              ),
              "min_samples_leaf": np.array(
                  [
                      1.7516926954624357,
                      1.901317408816101,
                      2.134928323868993,
                      2.272179337814922,
                      2.481767480132848,
                      1.778913732091379,
                      1.7503011299565185,
                      2.634132917484797,
                      2.3551239865216638,
                      3.6423411901787532,
                      1.7516926954624357,
                      1.901317408816101,
                      2.134928323868993,
                      2.272179337814922,
                      2.481767480132848,
                      1.778913732091379,
                      1.7503011299565185,
                      2.634132917484797,
                      2.3551239865216638,
                      3.6423411901787532,
                  ]
              ),
              "max_features": [
                  "sqrt",
                  "sqrt",
                  "log2",
                  "log2",
                  "sqrt",
                  "log2",
                  "log2",
                  "log2",
                  "log2",
                  "sqrt",
                  "sqrt",
                  "sqrt",
                  "log2",
                  "log2",
                  "sqrt",
                  "log2",
                  "log2",
                  "log2",
                  "log2",
                  "sqrt",
              ],
          },
          index=pd.RangeIndex(start=0, stop=20, step=1),
      ).sort_values(by="mean_absolute_error", ascending=True)
  
      pd.testing.assert_frame_equal(
          results, expected_results, check_dtype=False
      )
  
imports: import re
  import pytest
  import numpy
  import pandas
  import sys
  from pytest import approx
  from importlib import metadata
  from sklearn.ensemble import RandomForestRegressor
  from sklearn.linear_model import Ridge
  from sklearn.metrics import mean_absolute_error
  from skforecast.ForecasterAutoreg import ForecasterAutoreg
  from skforecast.ForecasterAutoregCustom import ForecasterAutoregCustom
  from skforecast.model_selection import backtesting_forecaster
  from .fixtures_model_selection import y
  from tqdm import tqdm
  from functools import partialmethod
label_desc: Use image node_id 3 for calling a global function with example usage: test_results_output_bayesian_search_skopt_ForecasterAutoreg_with_mocked() without return types