code: def get_basic_pipeline(
      estimator=SimpleSilverkiteEstimator(),
      score_func=EvaluationMetricEnum.MeanAbsolutePercentError.name,
      score_func_greater_is_better=False,
      agg_periods=None,
      agg_func=None,
      relative_error_tolerance=None,
      coverage=0.95,
      null_model_params=None,
      regressor_cols=None,
      lagged_regressor_cols=None,
  ):
      """Returns a basic pipeline for univariate forecasting.
      Allows for outlier detection, normalization, null imputation,
      degenerate column removal, and forecast model fitting. By default,
      only null imputation is enabled. See source code for the pipeline steps.
  
      Notes
      -----
      While ``score_func`` is used to define the estimator's score function, the
      the ``scoring`` parameter of `~sklearn.model_selection.RandomizedSearchCV`
      should be provided when using this pipeline in grid search.
      Otherwise, grid search assumes higher values are better for ``score_func``.
  
      Parameters
      ----------
      estimator : instance of an estimator that implements `greykite.sklearn.estimator.base_forecast_estimator.BaseForecastEstimator`, default SimpleSilverkiteEstimator()  # noqa: E501
          Estimator to use as the final step in the pipeline.
      score_func : `str` or callable, default ``EvaluationMetricEnum.MeanAbsolutePercentError.name``
          Score function used to select optimal model in CV.
          If a callable, takes arrays ``y_true``, ``y_pred`` and returns a float.
          If a string, must be either a
          `~greykite.common.evaluation.EvaluationMetricEnum` member name
          or `~greykite.common.constants.FRACTION_OUTSIDE_TOLERANCE`.
      score_func_greater_is_better : `bool`, default False
          True if ``score_func`` is a score function, meaning higher is better,
          and False if it is a loss function, meaning lower is better.
          Must be provided if ``score_func`` is a callable (custom function).
          Ignored if ``score_func`` is a string, because the direction is known.
      agg_periods : `int` or None, default None
          Number of periods to aggregate before evaluation.
          Model is fit at original frequency, and forecast is
          aggregated according to ``agg_periods``
          E.g. fit model on hourly data, and evaluate performance at daily level
          If None, does not apply aggregation
      agg_func : callable or None, default None
          Takes an array and returns a number, e.g. np.max, np.sum
          Used to aggregate data prior to evaluation (applied to actual and predicted)
          Ignored if ``agg_periods`` is None
      relative_error_tolerance : `float` or None, default None
          Threshold to compute the
          `~greykite.common.constants.FRACTION_OUTSIDE_TOLERANCE`
          metric, defined as the fraction of forecasted values whose relative
          error is strictly greater than ``relative_error_tolerance``.
          For example, 0.05 allows for 5% relative error.
          Required if ``score_func`` is
          `~greykite.common.constants.FRACTION_OUTSIDE_TOLERANCE`.
      coverage : `float` or None, default=0.95
          Intended coverage of the prediction bands (0.0 to 1.0)
          If None, the upper/lower predictions are not returned
          Ignored if `pipeline` is provided. Uses coverage of the ``pipeline`` estimator instead.
      null_model_params : `dict` or None, default None
          Defines baseline model to compute ``R2_null_model_score`` evaluation metric.
          ``R2_null_model_score`` is the improvement in the loss function relative
          to a null model. It can be used to evaluate model quality with respect to
          a simple baseline. For details, see
          `~greykite.common.evaluation.r2_null_model_score`.
  
          The null model is a `~sklearn.dummy.DummyRegressor`,
          which returns constant predictions.
  
          Valid keys are "strategy", "constant", "quantile".
          See `~sklearn.dummy.DummyRegressor`. For example::
  
              null_model_params = {
                  "strategy": "mean",
              }
              null_model_params = {
                  "strategy": "median",
              }
              null_model_params = {
                  "strategy": "quantile",
                  "quantile": 0.8,
              }
              null_model_params = {
                  "strategy": "constant",
                  "constant": 2.0,
              }
  
          If None, ``R2_null_model_score`` is not calculated.
  
          Note: CV model selection always optimizes ``score_func`, not
          the ``R2_null_model_score``.
      regressor_cols : `list` [`str`] or None, default None
          A list of regressor columns used in the training and prediction DataFrames.
          It should contain only the regressors that are being used in the grid search.
          If None, no regressor columns are used.
          Regressor columns that are unavailable in ``df`` are dropped.
      lagged_regressor_cols: `list` [`str`] or None, default None
          A list of additional columns needed for lagged regressors in the training and prediction DataFrames.
          This list can have overlap with ``regressor_cols``.
          If None, no additional columns are added to the DataFrame.
          Lagged regressor columns that are unavailable in ``df`` are dropped.
  
      Returns
      -------
      pipeline : `sklearn.pipeline.Pipeline`
          sklearn Pipeline for univariate forecasting.
      """
      score_func, _, _ = get_score_func_with_aggregation(
          score_func=score_func,
          greater_is_better=score_func_greater_is_better,
          agg_periods=agg_periods,
          agg_func=agg_func,
          relative_error_tolerance=relative_error_tolerance,
      )
  
      if regressor_cols is None:
          regressor_cols = []
      if lagged_regressor_cols is None:
          lagged_regressor_cols = []
      all_reg_cols = unique_elements_in_list(
          regressor_cols + lagged_regressor_cols
      )
  
      # A new unfitted estimator with the same parameters
      estimator_clone = clone(estimator)
      # Sets parameters common to all `BaseForecastEstimator`
      estimator_clone.set_params(
          score_func=score_func,
          coverage=coverage,
          null_model_params=null_model_params,
      )
  
      # Note:
      #   Unlike typical ML, "y" (target values) is part of "X" (training data).
      #   Some forecasting models require that all historical values are available
      #   (no gaps in the timeseries). By including "y" values as part of "X", they
      #   can be transformed prior to fitting the estimator. This allows outlier removal and
      #   null imputation that respects train/test boundaries, to avoid leaking future
      #   information into the past. Evaluation is always done against original "y".
      #   Parameters for this pipeline are set via `hyperparameter_grid`.
      pipeline = Pipeline(
          [
              (
                  "input",
                  PandasFeatureUnion(
                      [
                          (
                              "date",
                              Pipeline(
                                  [
                                      (
                                          "select_date",
                                          ColumnSelector([TIME_COL]),
                                      )  # leaves time column unmodified
                                  ]
                              ),
                          ),
                          (
                              "response",
                              Pipeline(
                                  [  # applies outlier and null transformation to value column
                                      (
                                          "select_val",
                                          ColumnSelector([VALUE_COL]),
                                      ),
                                      (
                                          "outlier",
                                          DifferenceBasedOutlierTransformer(),
                                      ),
                                      (
                                          "null",
                                          NullTransformer(
                                              impute_algorithm="interpolate"
                                          ),
                                      ),
                                  ]
                              ),
                          ),
                          (
                              "regressors_numeric",
                              Pipeline(
                                  [
                                      (
                                          "select_reg",
                                          ColumnSelector(all_reg_cols),
                                      ),
                                      (
                                          "select_reg_numeric",
                                          DtypeColumnSelector(
                                              include="number"
                                          ),
                                      ),
                                      (
                                          "outlier",
                                          DifferenceBasedOutlierTransformer(),
                                      ),
                                      (
                                          "normalize",
                                          NormalizeTransformer(
                                              normalize_algorithm=None
                                          ),
                                      ),  # no normalization by default
                                      (
                                          "null",
                                          NullTransformer(
                                              impute_algorithm="interpolate"
                                          ),
                                      ),
                                  ]
                              ),
                          ),
                          (
                              "regressors_other",
                              Pipeline(
                                  [
                                      (
                                          "select_reg",
                                          ColumnSelector(all_reg_cols),
                                      ),
                                      (
                                          "select_reg_non_numeric",
                                          DtypeColumnSelector(
                                              exclude="number"
                                          ),
                                      ),
                                  ]
                              ),
                          ),
                      ]
                  ),
              ),
              (
                  "degenerate",
                  DropDegenerateTransformer(),
              ),  # default `drop_degenerate=False`
              # Sets BaseForecastEstimator parameters (`score_func`, etc.).
              # Other parameters of the estimator are set by `hyperparameter_grid` later.
              ("estimator", estimator_clone),
          ]
      )
      return pipeline
  
imports: import math
  from functools import partial
  import pandas
  from sklearn.base import clone
  from sklearn.model_selection import ParameterGrid
  from sklearn.model_selection import RandomizedSearchCV
  from sklearn.pipeline import Pipeline
  from greykite.common import constants
  from greykite.common.constants import FRACTION_OUTSIDE_TOLERANCE
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
  from greykite.common.evaluation import EvaluationMetricEnum
  from greykite.common.evaluation import add_finite_filter_to_scorer
  from greykite.common.evaluation import add_preaggregation_to_scorer
  from greykite.common.evaluation import fraction_outside_tolerance
  from greykite.common.logging import LoggingLevelEnum
  from greykite.common.logging import log_message
  from greykite.common.python_utils import get_integer
  from greykite.common.python_utils import unique_elements_in_list
  from greykite.common.time_properties_forecast import get_default_horizon_from_period
  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.output.univariate_forecast import UnivariateForecast
  from greykite.sklearn.estimator.simple_silverkite_estimator import SimpleSilverkiteEstimator
  from greykite.sklearn.sklearn_scorer import make_scorer_df
  from greykite.sklearn.transform.column_selector import ColumnSelector
  from greykite.sklearn.transform.difference_based_outlier_transformer import DifferenceBasedOutlierTransformer
  from greykite.sklearn.transform.drop_degenerate_transformer import DropDegenerateTransformer
  from greykite.sklearn.transform.dtype_column_selector import DtypeColumnSelector
  from greykite.sklearn.transform.normalize_transformer import NormalizeTransformer
  from greykite.sklearn.transform.null_transformer import NullTransformer
  from greykite.sklearn.transform.pandas_feature_union import PandasFeatureUnion
label_desc: Use image node_id 3 for calling a global function with example usage: get_basic_pipeline(estimator, score_func, score_func_greater_is_better, agg_periods, agg_func, relative_error_tolerance, coverage, null_model_params, regressor_cols, lagged_regressor_cols) and returns: pipeline