code: def test_get_hyperparameter_searcher():
      """Tests get_hyperparameter_searcher"""
      model = DummyEstimator()
      with LogCapture(LOGGER_NAME) as log_capture:
          hyperparameter_grid = {
              "strategy": ["mean", "median", "quantile", "constant"],
              "constant": [20.0],
              "quantile": [0.8],
          }
          grid_search = get_hyperparameter_searcher(
              hyperparameter_grid=hyperparameter_grid, model=model
          )
          assert grid_search.n_iter == 4
          scoring, refit = get_scoring_and_refit()
          assert_scoring(
              scoring=grid_search.scoring, expected_keys=scoring.keys()
          )
          assert grid_search.n_jobs == 1
          assert_refit(
              grid_search.refit,
              expected_metric=EvaluationMetricEnum.MeanAbsolutePercentError.get_metric_name(),
              expected_greater_is_better=False,
          )
          assert grid_search.cv is None
          assert grid_search.verbose == 1
          assert grid_search.pre_dispatch == "2*n_jobs"
          assert grid_search.return_train_score
          log_capture.check(
              (
                  LOGGER_NAME,
                  "DEBUG",
                  f"Setting hyperparameter_budget to 4 for full grid search.",
              )
          )
  
      with LogCapture(LOGGER_NAME) as log_capture:
          # specifies `get_scoring_and_refit` kwargs, uses a distribution
          hyperparameter_grid = [
              {
                  "strategy": [
                      "mean",
                      "median",
                      "quantile",
                      "constant",
                  ],
                  "constant": [20.0],
                  "quantile": [0.8],
              },
              {
                  "strategy": ["constant"],
                  "constant": sp_randint(1, 3, 4),
              },
          ]
          grid_search = get_hyperparameter_searcher(
              hyperparameter_grid=hyperparameter_grid,
              model=model,
              cv=4,
              hyperparameter_budget=None,
              n_jobs=4,
              verbose=2,
              score_func=EvaluationMetricEnum.Quantile95.name,
              cv_report_metrics=CV_REPORT_METRICS_ALL,
          )
  
          assert grid_search.n_iter == 10
          enum_names = set(
              enum.get_metric_name() for enum in EvaluationMetricEnum
          )
          assert_scoring(
              scoring=grid_search.scoring, expected_keys=enum_names
          )
          assert grid_search.n_jobs == 4
          assert_refit(
              grid_search.refit,
              expected_metric=EvaluationMetricEnum.Quantile95.get_metric_name(),
              expected_greater_is_better=False,
          )
          assert grid_search.cv == 4
          assert grid_search.verbose == 2
          assert grid_search.pre_dispatch == "2*n_jobs"
          assert grid_search.return_train_score
          log_capture.check(
              (
                  LOGGER_NAME,
                  "WARNING",
                  f"Setting hyperparameter_budget to 10 to sample from"
                  f" provided distributions (and lists).",
              )
          )
  
      with LogCapture(LOGGER_NAME) as log_capture:
          # specifies RollingTimeSeriesSplit `cv`, no logging messages
          hyperparameter_grid = [
              {
                  "strategy": [
                      "mean",
                      "median",
                      "quantile",
                      "constant",
                  ],
                  "constant": [20.0],
                  "quantile": [0.8],
              },
              {"strategy": ["constant"], "constant": sp_randint(1, 30)},
          ]
          hyperparameter_budget = 3
          cv = RollingTimeSeriesSplit(forecast_horizon=3)
          grid_search = get_hyperparameter_searcher(
              hyperparameter_grid=hyperparameter_grid,
              model=model,
              cv=cv,
              hyperparameter_budget=hyperparameter_budget,
              n_jobs=4,
              verbose=2,
          )
  
          assert grid_search.n_iter == hyperparameter_budget
          assert grid_search.n_jobs == 4
          assert isinstance(grid_search.cv, RollingTimeSeriesSplit)
          assert grid_search.verbose == 2
          assert grid_search.pre_dispatch == "2*n_jobs"
          assert grid_search.return_train_score
          log_capture.check()
  
imports: import sys
  import warnings
  from functools import partial
  import numpy
  import pandas
  import pytest
  from scipy.stats import randint
  from sklearn.metrics import mean_absolute_error
  from sklearn.metrics import mean_squared_error
  from sklearn.metrics import median_absolute_error
  from sklearn.pipeline import Pipeline
  from testfixtures import LogCapture
  from greykite.common import constants
  from greykite.common.constants import FRACTION_OUTSIDE_TOLERANCE
  from greykite.common.constants import LOGGER_NAME
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import add_preaggregation_to_scorer
  from greykite.common.evaluation import fraction_outside_tolerance
  from greykite.common.python_utils import assert_equal
  from greykite.common.testing_utils import assert_eval_function_equal
  from greykite.common.testing_utils import generate_df_for_tests
  from greykite.common.testing_utils import generate_df_with_reg_for_tests
  from greykite.framework.constants import CUSTOM_SCORE_FUNC_NAME
  from greykite.framework.constants import CV_REPORT_METRICS_ALL
  from greykite.framework.constants import FRACTION_OUTSIDE_TOLERANCE_NAME
  from greykite.framework.pipeline.utils import get_basic_pipeline
  from greykite.framework.pipeline.utils import get_best_index
  from greykite.framework.pipeline.utils import get_default_time_parameters
  from greykite.framework.pipeline.utils import get_forecast
  from greykite.framework.pipeline.utils import get_hyperparameter_searcher
  from greykite.framework.pipeline.utils import get_score_func_with_aggregation
  from greykite.framework.pipeline.utils import get_scoring_and_refit
  from greykite.framework.utils.framework_testing_utils import assert_proper_grid_search
  from greykite.framework.utils.framework_testing_utils import assert_refit
  from greykite.framework.utils.framework_testing_utils import assert_scoring
  from greykite.sklearn.cross_validation import RollingTimeSeriesSplit
  from greykite.sklearn.estimator.null_model import DummyEstimator
  from greykite.sklearn.estimator.prophet_estimator import ProphetEstimator
  from greykite.sklearn.estimator.silverkite_estimator import SilverkiteEstimator
  from greykite.sklearn.transform.column_selector import ColumnSelector
label_desc: Use image node_id 9 for calling a global function with example usage: test_get_hyperparameter_searcher() without return types