code: def test_pipeline_after_finalizing(load_pos_and_neg_data_missing):
      """After finalizing the model, the data memory in the Forecasting Pipeline
      must match with the memory in the model used in the pipeline (last step of pipeline)
      """
      data = load_pos_and_neg_data_missing
  
      exp = TSForecastingExperiment()
      FH = 12
      exp.setup(data=data, fh=FH, numeric_imputation_target="drift")
  
      model = exp.create_model("exp_smooth")
      final = exp.finalize_model(model)
  
      exp.save_model(final, "my_model")
      loaded_model = exp.load_model("my_model")
  
      # Check if pipeline data index (ForecastingPipeline) matches up with
      # the actual model data
      assert len(loaded_model._y.index) == len(
          loaded_model.steps[-1][1].steps[-1][1]._y.index
      )
      assert np.array_equal(
          loaded_model._y.index,
          loaded_model.steps[-1][1].steps[-1][1]._y.index,
      )
  
imports: import os
  import numpy
  import pytest
  import sktime
  from packaging import version
  from sktime.forecasting.compose import ForecastingPipeline, TransformedTargetForecaster
  from time_series_test_utils import _IMPUTE_METHODS_STR, _SCALE_METHODS, _TRANSFORMATION_METHODS, _TRANSFORMATION_METHODS_NO_NEG, _return_model_names_for_missing_data
  from pycaret.time_series import TSForecastingExperiment
label_desc: Use image node_id 18 for calling a global function with example usage: test_pipeline_after_finalizing(load_pos_and_neg_data_missing) without return types