code: def test_summary(daily_data, forecast_config_info_daily):
      """Tests ``summary`` method."""
      df_train = daily_data["df_train"]
      forecast_config = forecast_config_info_daily
      ad_config = ADConfig(
          coverage_grid=[
              0.2,
              0.5,
              0.55,
              0.6,
              0.65,
              0.7,
              0.75,
              0.9,
              0.95,
              0.99,
              0.999,
          ],
          target_anomaly_percent=None,
          ape_grid=[0, 20, 50],
          variance_scaling=True,
      )
  
      train_data = DetectorData(df=df_train)
  
      def reward_func(data):
          return calc_f1(y_true=data.y_true, y_pred=data.y_pred)
  
      reward = Reward(reward_func)
  
      detector = GreykiteDetector(
          forecast_config=forecast_config,
          ad_config=ad_config,
          reward=reward,
      )
      detector.fit(data=train_data)
  
      summary = detector.summary()
      assert "Anomaly Detection Model Summary" in summary
      assert "Average Anomaly Duration" in summary
      assert "Precision" in summary
      assert "Recall" in summary
      assert "Optimal Parameters" in summary
      # Checks if the summary contains the forecast model summary.
      assert "Residuals" in summary
      assert "Multiple R-squared" in summary
  
imports: import datetime
  import numpy
  import pandas
  import plotly.express
  import pytest
  from greykite.common.constants import ACTUAL_COL
  from greykite.common.constants import ANOMALY_COL
  from greykite.common.constants import END_TIME_COL
  from greykite.common.constants import PREDICTED_ANOMALY_COL
  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.common.constants import START_TIME_COL
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils_anomalies import contaminate_df_with_anomalies
  from greykite.common.viz.timeseries_annotate import plot_anomalies_over_forecast_vs_actual
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
  from greykite.common.viz.timeseries_annotate import plt_compare_series_annotations
  from greykite.detection.common.ad_evaluation import f1_score
  from greykite.detection.common.ad_evaluation import precision_score
  from greykite.detection.common.ad_evaluation import recall_score
  from greykite.detection.detector.ad_utils import partial_return
  from greykite.detection.detector.config import F1
  from greykite.detection.detector.config import ADConfig
  from greykite.detection.detector.data import DetectorData
  from greykite.detection.detector.greykite import DETECTOR_PREDICT_COLS
  from greykite.detection.detector.greykite import GreykiteDetector
  from greykite.detection.detector.reward import Reward
  from greykite.framework.templates.autogen.forecast_config import EvaluationPeriodParam
  from greykite.framework.templates.autogen.forecast_config import ForecastConfig
  from greykite.framework.templates.autogen.forecast_config import MetadataParam
  from greykite.framework.templates.autogen.forecast_config import ModelComponentsParam
label_desc: Use image node_id 14 for calling a global function with example usage: test_summary(daily_data, forecast_config_info_daily) and returns: calc_f1