code: def test_tune_model_alternate_metric(load_pos_and_neg_data, metric):
      """tests model selection using non default metric"""
      exp = TSForecastingExperiment()
      fh = 12
      fold = 2
  
      exp.setup(
          data=load_pos_and_neg_data,
          fold=fold,
          fh=fh,
          fold_strategy="sliding",
      )
  
      model_obj = exp.create_model("naive")
  
      tuned_model_obj = exp.tune_model(model_obj, optimize=metric)
      y_pred = exp.predict_model(tuned_model_obj)
      assert isinstance(y_pred, pd.DataFrame)
  
      expected_period_index = load_pos_and_neg_data.iloc[-fh:].index
      assert np.all(y_pred.index == expected_period_index)
  
file_path: pycaret/tests/test_time_series_tune_base.py
imports: import numpy
  import pandas
  import pytest
  from sktime.forecasting.compose import ForecastingPipeline
  from time_series_test_utils import _ALL_METRICS
  from pycaret.time_series import TSForecastingExperiment
label_desc: Use image node_id 3 for calling a global function with example usage: test_tune_model_alternate_metric(load_pos_and_neg_data, metric) without return types