code: def get_alpha_estimator(
      cv,
      X,
      max_degree=None,
      estimator_list=None,
      estimator_param_list=None,
      numeric_features=None,
      plugin_reisz=True,
  ):
      """
      Finds the best estimator for reisz representer (alpha_s )
  
      :param cv: training and testing data indices obtained afteer Kfolding the dataset
      :param X: treatment+confounders
      :param max_degree: degree of the polynomial function used to approximate alpha_s
      :param param_grid_dict: python dictionary with parameters to tune the ReiszRepresenter estimator
  
      :returns: estimator for alpha_s
  
      This method assumes a binary T.
      """
  
      if plugin_reisz:
          if estimator_param_list is None:
              estimator_list = [
                  RandomForestClassifier(
                      n_estimators=100, random_state=120
                  ),
                  Pipeline(
                      [
                          (
                              "scale",
                              ColumnTransformer(
                                  [
                                      (
                                          "num",
                                          StandardScaler(),
                                          numeric_features,
                                      )
                                  ],
                                  remainder="passthrough",
                              ),
                          ),
                          ("logistic_model", LogisticRegression()),
                      ]
                  ),
                  GradientBoostingClassifier(),
              ]
              estimator_param_list = [
                  {
                      "n_estimators": [50],
                      "max_depth": [3, 4, 5],
                      "min_samples_leaf": [10, 50],
                  },
                  {"logistic_model__C": [1, 0.01, 0.001, 1e-4, 1e-5]},
                  {
                      "learning_rate": [0.01, 0.001],
                      "n_estimators": [50, 200],
                  },
              ]
          W = X[:, 1:]  # assume 1-D treatment
          t = X[:, 0]
          propmodel = get_generic_regressor(
              cv=cv,
              X=W,
              Y=t,
              max_degree=max_degree,
              estimator_list=estimator_list,
              estimator_param_list=estimator_param_list,
              numeric_features=numeric_features,
          )
          reisz_fn = PluginReisz(propmodel)
      else:
          if estimator_param_list is None:
              estimator_param_list = [
                  {
                      "reisz_functions": [
                          create_polynomial_function(2),
                          create_polynomial_function(1),
                      ],
                      "min_samples_leaf": [10, 50],
                      "min_var_fraction_leaf": [0.01, 0.1],
                      "l2_regularizer": [1e-5, 1e-3],
                      "max_depth": [5, None],
                  }
              ]
          estimator = GridSearchCVList(
              [
                  ReiszRepresenter(
                      reisz_functions=create_polynomial_function(
                          max_degree
                      ),
                      moment_function=generate_moment_function,
                      min_samples_leaf=10,
                      min_var_fraction_leaf=0.01,
                      max_depth=5,
                  )
              ],
              param_grid_list=estimator_param_list,
              scoring=reisz_scoring,
              cv=cv,
              verbose=0,
              n_jobs=-1,
          ).fit(X)
          reisz_fn = estimator.best_estimator_
      return reisz_fn
  
imports: import numpy
  from econml.grf._base_grf import BaseGRF
  from econml.sklearn_extensions.model_selection import GridSearchCVList
  from econml.utilities import cross_product
  from sklearn.compose import ColumnTransformer
  from sklearn.ensemble import GradientBoostingClassifier, GradientBoostingRegressor, RandomForestClassifier, RandomForestRegressor
  from sklearn.linear_model import Lasso, LogisticRegression
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import StandardScaler
  from dowhy.utils.regression import create_polynomial_function, generate_moment_function
label_desc: Use image node_id 1 for calling a global function with example usage: get_alpha_estimator(cv, X, max_degree, estimator_list, estimator_param_list, numeric_features, plugin_reisz) and returns: reisz_fn