code: def add_model_params_tree(info_dict):
      """Adds model parameters to `info_dict` for tree models.
  
      Only model-related parameter information will be added in this function.
      A series of these functions are used in a flow to get all information needed
      in tree model summary. The flow is
      `~greykite.algo.common.model_summary_utils.create_info_dict_tree`,
      `~greykite.algo.common.model_summary_utils.add_model_params_tree`,
      `~greykite.algo.common.model_summary_utils.add_model_coef_df_tree`.
      For flow implementation, see
      `~greykite.algo.common.model_summary_utils.get_info_dict_tree`.
  
      Parameters
      ----------
      info_dict : `dict`
          The information dictionary returned by
          `~greykite.algo.common.model_summary_utils.create_info_dict_tree`.
  
      Returns
      -------
      info_dict : `dict`
          The information dictionary with the following keys added:
  
              "model" : `str`
                  The model name.
              "num_tree" : `int`
                  Number of trees used.
              "criterion" : `str`
                  The criterion to be minimized.
              "max_depth" : `int` or `None`
                  The maximal tree depth.
              "subsample" : `float`, `int` or `None`
                  The subsampling proportion or a whole number to sample.
              "max_features" : `int` or `None`
                  The maximal number of features to be used in a single split.
      """
      fit_algorithm = info_dict["fit_algorithm"]
      ml_model = info_dict["ml_model"]
      valid_tree_fit_algorithms = ["rf", "gradient_boosting"]
      if fit_algorithm in valid_tree_fit_algorithms:
          if fit_algorithm == "gradient_boosting":
              info_dict["model"] = "Gradient Boosting"
              info_dict["num_tree"] = ml_model.n_estimators_
              info_dict["criterion"] = ml_model.criterion
              info_dict["max_depth"] = ml_model.max_depth
              info_dict["subsample"] = ml_model.subsample
              info_dict["max_features"] = ml_model.max_features_
          elif fit_algorithm == "rf":
              info_dict["model"] = "Random Forest"
              info_dict["num_tree"] = ml_model.n_estimators
              info_dict["criterion"] = ml_model.criterion
              info_dict["max_depth"] = ml_model.max_depth
              info_dict["subsample"] = ml_model.max_samples
              info_dict["max_features"] = ml_model.max_features
      else:
          raise ValueError(
              f"{fit_algorithm} is not a valid algorithm, it must be in "
              f"{valid_tree_fit_algorithms}."
          )
      return info_dict
  
imports: import numpy
  import pandas
  import statsmodels
  import statsmodels.api
  from scipy.stats import f
  from scipy.stats import norm
  from scipy.stats import t
  from sklearn.base import clone
  from sklearn.linear_model import Ridge
  from sklearn.model_selection import train_test_split
  from greykite.algo.common.col_name_utils import INTERCEPT
  from greykite.algo.common.col_name_utils import simplify_pred_cols
label_desc: Use image node_id 20 for calling a global function with example usage: add_model_params_tree(info_dict) and returns: info_dict