code: def test_base_detect_diff_from_baseline_es():
      """Tests `diff_from_baseline` method with exponential smoothing."""
      detect_outlier = BaseOutlierDetector()
      y = np.arange(100)
  
      # Example with exponential smoothing.
      baseline_result = detect_outlier.diff_from_baseline(
          y=y, diff_method=EXPONENTIAL_SMOOTHING
      )
  
      residuals = baseline_result["residuals"]
      baseline_y = baseline_result["baseline_y"]
  
      # Original range.
      assert min(y) == 0
      assert max(y) == 99
  
      # Residuals range.
      assert min(residuals) == 0
      assert abs(max(residuals) - 1.0) < 0.1
  
      # Example with exponential smoothing.
      y = pd.Series([0, 0, 0, 10, 10, 10, 10, 0, 0, 0])
      baseline_result = detect_outlier.diff_from_baseline(
          y=y, diff_method=EXPONENTIAL_SMOOTHING
      )
      residuals = baseline_result["residuals"]
      baseline_y = baseline_result["baseline_y"]
  
      assert (round(baseline_y) == [0, 0, 0, 5, 8, 9, 9, 5, 2, 1]).all()
      assert (
          round(residuals) == [0, 0, 0, 5, 2, 1, 1, -5, -2, -1]
      ).all()
  
      # Another example with custom `alpha = 1`.
      # This will imply that `y` is unchanged and residuals are all zero.
      y = pd.Series([0, 0, 0, 10, 10, 10, 10, 0, 0, 0])
      diff_method = DiffMethod(name="es", param={"alpha": 1})
      baseline_result = detect_outlier.diff_from_baseline(
          y=y, diff_method=diff_method
      )
      residuals = baseline_result["residuals"]
      baseline_y = baseline_result["baseline_y"]
  
      assert (baseline_y == y).all()
      assert (residuals == [0] * 10).all()
  
imports: import numpy
  import pandas
  import pytest
  from greykite.common.features.outlier import EXPONENTIAL_SMOOTHING
  from greykite.common.features.outlier import MOVING_MEDIAN
  from greykite.common.features.outlier import BaseOutlierDetector
  from greykite.common.features.outlier import DetectionResult
  from greykite.common.features.outlier import DiffMethod
  from greykite.common.features.outlier import TukeyOutlierDetector
  from greykite.common.features.outlier import ZScoreOutlierDetector
  from greykite.common.viz.timeseries_annotate import plot_lines_markers
label_desc: Use image node_id 8 for calling a global function with example usage: test_base_detect_diff_from_baseline_es() without return types