class_docstr: A parent class for DR-learner regressor classes.
  
  A DR-learner estimates treatment effects with machine learning models.
  
  Details of DR-learner are available at Kennedy (2020) (https://arxiv.org/abs/2004.14497).
class_docstr_tok: ["A","parent","class","for","DR-learner","regressor","classes",".","A","DR-learner","estimates","treatment","effects","with","machine","learning","models",".","Details","of","DR-learner","are","available","at","Kennedy","(","2020",")","(","https",":","\/\/arxiv.org\/abs\/2004.14497",")","."]
docstr: Predict treatment effects.
  
  Args:
      X (np.matrix or np.array or pd.Dataframe): a feature matrix
      treatment (np.array or pd.Series, optional): a treatment vector
      y (np.array or pd.Series, optional): an outcome vector
      verbose (bool, optional): whether to output progress logs
  Returns:
      (numpy.ndarray): Predictions of treatment effects.
docstr_tok: ["Predict","treatment","effects",".","Args",":","X","(","np.matrix","or","np.array","or","pd.Dataframe",")",":","a","feature","matrix","treatment","(","np.array","or","pd.Series",",","optional",")",":","a","treatment","vector","y","(","np.array","or","pd.Series",",","optional",")",":","an","outcome","vector","verbose","(","bool",",","optional",")",":","whether","to","output","progress","logs","Returns",":","(","numpy.ndarray",")",":","Predictions","of","treatment","effects","."]
code: def predict(
      self,
      X,
      treatment=None,
      y=None,
      p=None,
      return_components=False,
      verbose=True,
  ):
      """Predict treatment effects.
  
      Args:
          X (np.matrix or np.array or pd.Dataframe): a feature matrix
          treatment (np.array or pd.Series, optional): a treatment vector
          y (np.array or pd.Series, optional): an outcome vector
          verbose (bool, optional): whether to output progress logs
      Returns:
          (numpy.ndarray): Predictions of treatment effects.
      """
      X, treatment, y = convert_pd_to_np(X, treatment, y)
  
      te = np.zeros((X.shape[0], self.t_groups.shape[0]))
      yhat_cs = {}
      yhat_ts = {}
  
      for i, group in enumerate(self.t_groups):
          models_tau = self.models_tau[group]
          _te = np.r_[[model.predict(X) for model in models_tau]].mean(
              axis=0
          )
          te[:, i] = np.ravel(_te)
          yhat_cs[group] = np.r_[
              [model.predict(X) for model in self.models_mu_c]
          ].mean(axis=0)
          yhat_ts[group] = np.r_[
              [model.predict(X) for model in self.models_mu_t[group]]
          ].mean(axis=0)
  
          if (y is not None) and (treatment is not None) and verbose:
              mask = (treatment == group) | (
                  treatment == self.control_name
              )
              treatment_filt = treatment[mask]
              X_filt = X[mask]
              y_filt = y[mask]
              w = (treatment_filt == group).astype(int)
  
              yhat = np.zeros_like(y_filt, dtype=float)
              yhat[w == 0] = yhat_cs[group][mask][w == 0]
              yhat[w == 1] = yhat_ts[group][mask][w == 1]
  
              logger.info("Error metrics for group {}".format(group))
              regression_metrics(y_filt, yhat, w)
  
      if not return_components:
          return te
      else:
          return te, yhat_cs, yhat_ts
  
imports: from copy import deepcopy
  import logging
  import numpy
  import pandas
  from scipy.stats import norm
  from sklearn.model_selection import cross_val_predict, KFold
  from tqdm import tqdm
  from xgboost import XGBRegressor
  from causalml.inference.meta.base import BaseLearner
  from causalml.inference.meta.utils import check_treatment_vector, check_p_conditions, convert_pd_to_np
  from causalml.metrics import regression_metrics, classification_metrics
  from causalml.propensity import compute_propensity_score
label_desc: Use image node_id 4 for calling the BaseDRLearner obj's underlying member method code with example usage: obj.predict(X, treatment, y, p, return_components, verbose) and returns: te, te,  yhat_cs,  yhat_ts