code: def test_backtester_with_training_data(iclaims_training_data):
      df = iclaims_training_data
  
      lgt = LGT(
          response_col="claims",
          date_col="week",
          seasonality=1,
          verbose=False,
          n_bootstrap_draws=100,
          prediction_percentiles=[10, 90],
          estimator="stan-map",
      )
  
      backtester = BackTester(
          model=lgt,
          df=df,
          min_train_len=100,
          incremental_len=100,
          forecast_len=20,
      )
  
      backtester.fit_predict()
      out = backtester.get_predicted_df()
      eval_out = backtester.score(include_training_metrics=True)
  
      expected_out_columns = [
          "date",
          "split_key",
          "training_data",
          "actual",
          "prediction",
          "prediction_10",
          "prediction_90",
      ]
      assert set(out.columns.tolist()) == set(expected_out_columns)
  
      evaluated_test_metrics = set(
          eval_out.loc[
              ~eval_out["is_training_metric"], "metric_name"
          ].tolist()
      )
      evaluated_train_metrics = set(
          eval_out.loc[
              eval_out["is_training_metric"], "metric_name"
          ].tolist()
      )
      expected_test_metrics = [
          x.__name__ for x in backtester._default_metrics
      ]
      expected_train_metrics = list(
          filter(
              lambda x: backtester._get_metric_callable_signature(x)
              == {"actual", "prediction"},
              backtester._default_metrics,
          )
      )
      expected_train_metrics = [
          x.__name__ for x in expected_train_metrics
      ]
  
      assert set(expected_test_metrics) == evaluated_test_metrics
      assert set(expected_train_metrics) == evaluated_train_metrics
  
      # default metric has 6 values where rmsse is only used in test metric
      num_training_metrics = 5
      num_testing_metrics = 6
  
      train_metric_val = eval_out.loc[
          eval_out["is_training_metric"], "metric_values"
      ].values
      test_metric_val = eval_out.loc[
          ~eval_out["is_training_metric"], "metric_values"
      ].values
  
      assert len(train_metric_val) == num_training_metrics
      assert len(test_metric_val) == num_testing_metrics
      assert np.all(~np.isnan(train_metric_val))
      assert np.all(~np.isnan(test_metric_val))
  
file_path: orbit/tests/orbit/diagnostics/test_backtest.py
imports: import pytest
  import pandas
  import numpy
  from orbit.diagnostics.backtest import TimeSeriesSplitter, BackTester
  from orbit.diagnostics.metrics import smape, wmape, mae
  from orbit.models import LGT, KTRLite
label_desc: Use image node_id 5 for calling a global function with example usage: test_backtester_with_training_data(iclaims_training_data) without return types