code: def test_uncertainty(df_daily):
      """Tests uncertainty."""
      df_train = df_daily["df_train"]
      df_test = df_daily["df_test"]
  
      model = LagBasedEstimator(
          coverage=0.95,
          uncertainty_dict={
              "uncertainty_method": "simple_conditional_residuals",
              "value_col": "y",
              "conditional_cols": ["dow"],
          },
      )
      model.fit(df_train)
      assert model.uncertainty_model is not None
  
      # Checks prediction within training.
      df_fit = model.predict(df_train)
      # The value column should be the same as the input.
      assert df_fit["y"].equals(df_train["y"].astype(float))
      # The predicted column is the last week.
      assert (
          df_fit[PREDICTED_COL]
          .iloc[-5:]
          .reset_index(drop=True)
          .equals(df_fit["y"].iloc[-12:-7].reset_index(drop=True))
      )
      # Uncertainty columns are in the output.
      assert list(df_fit.columns) == [
          "ts",
          "y",
          PREDICTED_COL,
          PREDICTED_LOWER_COL,
          PREDICTED_UPPER_COL,
          ERR_STD_COL,
      ]
  
      # Checks prediction in the future.
      df_pred = model.predict(df_test)
      # The value column should be NANs.
      assert all(df_pred["y"].isna())
      # The predicted column is the last week.
      assert (
          df_pred[PREDICTED_COL]
          .iloc[:7]
          .reset_index(drop=True)
          .equals(df_fit["y"].iloc[-7:].reset_index(drop=True))
      )
      # The future predictions use the predicted values.
      assert (
          df_pred[PREDICTED_COL]
          .iloc[7:14]
          .reset_index(drop=True)
          .equals(
              df_pred[PREDICTED_COL].iloc[:7].reset_index(drop=True)
          )
      )
      # Uncertainty columns are in the output.
      assert list(df_pred.columns) == [
          "ts",
          "y",
          PREDICTED_COL,
          PREDICTED_LOWER_COL,
          PREDICTED_UPPER_COL,
          ERR_STD_COL,
      ]
  
imports: from datetime import timedelta
  import numpy
  import pandas
  import pytest
  from dateutil.relativedelta import relativedelta
  from testfixtures import LogCapture
  from greykite.common.constants import ERR_STD_COL
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.constants import PREDICTED_COL
  from greykite.common.constants import PREDICTED_LOWER_COL
  from greykite.common.constants import PREDICTED_UPPER_COL
  from greykite.sklearn.estimator.lag_based_estimator import LagBasedEstimator
label_desc: Use image node_id 11 for calling a global function with example usage: test_uncertainty(df_daily) without return types