code: def get_default_time_parameters(
      period,
      num_observations,
      forecast_horizon=None,
      test_horizon=None,
      periods_between_train_test=None,
      cv_horizon=None,
      cv_min_train_periods=None,
      cv_expanding_window=False,
      cv_periods_between_splits=None,
      cv_periods_between_train_test=None,
      cv_max_splits=3,
  ):
      """Returns default forecast horizon, backtest, and cross-validation parameters,
      given the input frequency, size, and user requested values.
  
      This function is called from the `~greykite.framework.pipeline.pipeline.forecast_pipeline`
      directly, to provide suitable default to users of forecast_pipeline, and because the default
      should not depend on model configuration (the template).
  
      Parameters
      ----------
      period: `float`
          Period of each observation (i.e. average time between observations, in seconds).
      num_observations: `int`
          Number of observations in the input data.
      forecast_horizon: `int` or None, default None
          Number of periods to forecast into the future. Must be > 0.
          If None, default is determined from input data frequency.
      test_horizon: `int` or None, default None
          Numbers of periods held back from end of df for test.
          The rest is used for cross validation.
          If None, default is ``forecast_horizon``. Set to 0 to skip backtest.
      periods_between_train_test : `int` or None, default None
          Number of periods gap between train and test in a CV split.
          If None, default is 0.
      cv_horizon: `int` or None, default None
          Number of periods in each CV test set.
          If None, default is ``forecast_horizon``. Set to 0 to skip CV.
      cv_min_train_periods: `int` or None, default None
          Minimum number of periods for training each CV fold.
          If ``cv_expanding_window`` is False, every training period is this size.
          If None, default is 2 * ``cv_horizon``.
      cv_expanding_window: `bool`, default False
          If True, training window for each CV split is fixed to the first available date.
          Otherwise, train start date is sliding, determined by ``cv_min_train_periods``.
      cv_periods_between_splits: `int` or None, default None
          Number of periods to slide the test window between CV splits
          If None, default is ``cv_horizon``.
      cv_periods_between_train_test: `int` or None, default None
          Number of periods gap between train and test in a CV split.
          If None, default is ``periods_between_train_test``.
      cv_max_splits: `int` or None, default 3
          Maximum number of CV splits. Given the above configuration, samples up to max_splits train/test splits,
          preferring splits toward the end of available data. If None, uses all splits.
  
      Returns
      -------
      time_params : `dict` [`str`, `int`]
          keys are parameter names, values are their default values.
      """
      if forecast_horizon is None:
          forecast_horizon = get_default_horizon_from_period(
              period=period, num_observations=num_observations
          )
      forecast_horizon = get_integer(
          val=forecast_horizon, name="forecast_horizon", min_value=1
      )
  
      test_horizon = get_integer(
          val=test_horizon,
          name="test_horizon",
          min_value=0,
          default_value=forecast_horizon,
      )
      # reduces test_horizon to default 80/20 split if there is not enough data
      if test_horizon >= num_observations:
          test_horizon = math.floor(num_observations * 0.2)
  
      cv_horizon = get_integer(
          val=cv_horizon,
          name="cv_horizon",
          min_value=0,
          default_value=forecast_horizon,
      )
      # RollingTimeSeriesSplit handles the case of no CV splits, not handled in detail here
      # temporary patch to avoid the case where cv_horizon==num_observations, which throws an error
      # in RollingTimeSeriesSplit
      if cv_horizon >= num_observations:
          cv_horizon = math.floor(num_observations * 0.2)
  
      periods_between_train_test = get_integer(
          val=periods_between_train_test,
          name="periods_between_train_test",
          min_value=0,
          default_value=0,
      )
  
      cv_periods_between_train_test = get_integer(
          val=cv_periods_between_train_test,
          name="cv_periods_between_train_test",
          min_value=0,
          default_value=periods_between_train_test,
      )
  
      return {
          "forecast_horizon": forecast_horizon,
          "test_horizon": test_horizon,
          "periods_between_train_test": periods_between_train_test,
          "cv_horizon": cv_horizon,
          "cv_min_train_periods": cv_min_train_periods,
          "cv_periods_between_train_test": cv_periods_between_train_test,
      }
  
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 2 for calling a global function with example usage: get_default_time_parameters(period, num_observations, forecast_horizon, test_horizon, periods_between_train_test, cv_horizon, cv_min_train_periods, cv_expanding_window, cv_periods_between_splits, cv_periods_between_train_test, cv_max_splits) and returns: dict