class_docstr: A parent class for X-learner classifier classes.
class_docstr_tok: ["A","parent","class","for","X-learner","classifier","classes","."]
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
      p (np.ndarray or pd.Series or dict, optional): an array of propensity scores of float (0,1) in the
          single-treatment case; or, a dictionary of treatment groups that map to propensity vectors of
          float (0,1); if None will run ElasticNetPropensityModel() to generate the propensity scores.
      return_components (bool, optional): whether to return outcome for treatment and control seperately
      return_p_score (bool, optional): whether to return propensity score
      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","p","(","np.ndarray","or","pd.Series","or","dict",",","optional",")",":","an","array","of","propensity","scores","of","float","(","0,1",")","in","the","single-treatment","case",";","or",",","a","dictionary","of","treatment","groups","that","map","to","propensity","vectors","of","float","(","0,1",")",";","if","None","will","run","ElasticNetPropensityModel","(",")","to","generate","the","propensity","scores",".","return_components","(","bool",",","optional",")",":","whether","to","return","outcome","for","treatment","and","control","seperately","return_p_score","(","bool",",","optional",")",":","whether","to","return","propensity","score","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
          p (np.ndarray or pd.Series or dict, optional): an array of propensity scores of float (0,1) in the
              single-treatment case; or, a dictionary of treatment groups that map to propensity vectors of
              float (0,1); if None will run ElasticNetPropensityModel() to generate the propensity scores.
          return_components (bool, optional): whether to return outcome for treatment and control seperately
          return_p_score (bool, optional): whether to return propensity score
          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)
  
      if p is None:
          logger.info("Generating propensity score")
          p = dict()
          for group in self.t_groups:
              p_model = self.propensity_model[group]
              p[group] = p_model.predict(X)
      else:
          p = self._format_p(p, self.t_groups)
  
      te = np.zeros((X.shape[0], self.t_groups.shape[0]))
      dhat_cs = {}
      dhat_ts = {}
  
      for i, group in enumerate(self.t_groups):
          model_tau_c = self.models_tau_c[group]
          model_tau_t = self.models_tau_t[group]
          dhat_cs[group] = model_tau_c.predict(X)
          dhat_ts[group] = model_tau_t.predict(X)
  
          _te = (
              p[group] * dhat_cs[group]
              + (1 - p[group]) * dhat_ts[group]
          ).reshape(-1, 1)
          te[:, i] = np.ravel(_te)
  
          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] = self.models_mu_c[group].predict_proba(
                  X_filt[w == 0]
              )[:, 1]
              yhat[w == 1] = self.models_mu_t[group].predict_proba(
                  X_filt[w == 1]
              )[:, 1]
  
              logger.info("Error metrics for group {}".format(group))
              classification_metrics(y_filt, yhat, w)
  
      if not return_components:
          return te
      else:
          return te, dhat_cs, dhat_ts
  
imports: from copy import deepcopy
  import logging
  import numpy
  import pandas
  from tqdm import tqdm
  from scipy.stats import norm
  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.inference.meta.explainer import Explainer
  from causalml.metrics import regression_metrics, classification_metrics
  from causalml.propensity import compute_propensity_score
label_desc: Use image node_id 3 for calling the BaseXClassifier obj's underlying member method code with example usage: obj.predict(X, treatment, y, p, return_components, verbose) and returns: te, te,  dhat_cs,  dhat_ts