code: def test_conf_interval_ecdf_method(data):
      """Testing `conf_interval` function with "ecdf" method"""
      df = data["df"]
      new_df = data["new_df"]
  
      # `quantile_estimation_method = "ecdf"`
      ci_model = conf_interval(
          df=df,
          distribution_col="residual",
          offset_col="y_hat",
          conditional_cols=["x"],
          quantiles=[0.005, 0.025, 0.975, 0.995],
          quantile_estimation_method="ecdf",
          sample_size_thresh=5,
          small_sample_size_method="std_quantiles",
          small_sample_size_quantile=0.95,
          min_admissible_value=None,
          max_admissible_value=None,
      )
  
      pred_df = predict_ci(new_df, ci_model)
      assert list(pred_df.columns) == list(df.columns) + [
          QUANTILE_SUMMARY_COL,
          ERR_STD_COL,
      ], "pred_df does not have the expected column names"
      pred_df[QUANTILE_SUMMARY_COL] = pred_df[
          QUANTILE_SUMMARY_COL
      ].apply(lambda x: tuple(round(e, 2) for e in x))
      pred_df[ERR_STD_COL] = round(pred_df[ERR_STD_COL], 2)
      assert pred_df[QUANTILE_SUMMARY_COL].values[5] == (
          290.69,
          290.75,
          292.67,
          292.71,
      ), "quantiles are incorrect"
      assert pred_df[QUANTILE_SUMMARY_COL].values[11] == (
          -4.0,
          -3.93,
          -2.5,
          -2.45,
      ), "quantiles are incorrect"
      expected_stds = [
          0.29,
          0.42,
          0.42,
          0.42,
          0.42,
          0.58,
          0.58,
          0.58,
          0.58,
          0.58,
          0.58,
          0.42,
      ]
      assert list(pred_df[ERR_STD_COL].values) == expected_stds
  
file_path: greykite/greykite/tests/algo/uncertainty/conditional/test_conf_interval.py
imports: import numpy
  import pytest
  from greykite.algo.uncertainty.conditional.conf_interval import conf_interval
  from greykite.algo.uncertainty.conditional.conf_interval import predict_ci
  from greykite.common.constants import ERR_STD_COL
  from greykite.common.constants import QUANTILE_SUMMARY_COL
  from greykite.common.testing_utils import gen_sliced_df
label_desc: Use image node_id 2 for calling a global function with example usage: test_conf_interval_ecdf_method(data) without return types