class_docstr: A Learner that learns a treatment assignment policy with observational data using doubly robust estimator of causal
  effect for binary treatment.
  
  Details of the policy learner are available at Athey and Wager (2018) (https://arxiv.org/abs/1702.02896).
class_docstr_tok: ["A","Learner","that","learns","a","treatment","assignment","policy","with","observational","data","using","doubly","robust","estimator","of","causal","effect","for","binary","treatment",".","Details","of","the","policy","learner","are","available","at","Athey","and","Wager","(","2018",")","(","https",":","\/\/arxiv.org\/abs\/1702.02896",")","."]
docstr: Initialize a treatment assignment policy learner.
  
  Args:
      outcome_learner (optional): a regression model to estimate outcomes
      policy_learner (optional): a classification model to estimate treatment assignment. It needs to take
          `sample_weight` as an input argument for `fit()`
      clip_bounds (tuple, optional): lower and upper bounds for clipping propensity scores to avoid division by
          zero in PolicyLearner.fit()
      n_fold (int, optional): the number of cross validation folds for outcome_learner
      random_state (int or RandomState, optional): a seed (int) or random number generator (RandomState)
docstr_tok: ["Initialize","a","treatment","assignment","policy","learner",".","Args",":","outcome_learner","(","optional",")",":","a","regression","model","to","estimate","outcomes","policy_learner","(","optional",")",":","a","classification","model","to","estimate","treatment","assignment",".","It","needs","to","take","`","sample_weight","`","as","an","input","argument","for","`","fit","(",")","`","clip_bounds","(","tuple",",","optional",")",":","lower","and","upper","bounds","for","clipping","propensity","scores","to","avoid","division","by","zero","in","PolicyLearner.fit","(",")","n_fold","(","int",",","optional",")",":","the","number","of","cross","validation","folds","for","outcome_learner","random_state","(","int","or","RandomState",",","optional",")",":","a","seed","(","int",")","or","random","number","generator","(","RandomState",")"]
code: def __init__(
      self,
      outcome_learner=GradientBoostingRegressor(),
      treatment_learner=GradientBoostingClassifier(),
      policy_learner=DecisionTreeClassifier(),
      clip_bounds=(1e-3, 1 - 1e-3),
      n_fold=5,
      random_state=None,
      calibration=False,
  ):
      """Initialize a treatment assignment policy learner.
  
      Args:
          outcome_learner (optional): a regression model to estimate outcomes
          policy_learner (optional): a classification model to estimate treatment assignment. It needs to take
              `sample_weight` as an input argument for `fit()`
          clip_bounds (tuple, optional): lower and upper bounds for clipping propensity scores to avoid division by
              zero in PolicyLearner.fit()
          n_fold (int, optional): the number of cross validation folds for outcome_learner
          random_state (int or RandomState, optional): a seed (int) or random number generator (RandomState)
      """
      self.model_mu = outcome_learner
      self.model_w = treatment_learner
      self.model_pi = policy_learner
      self.clip_bounds = clip_bounds
      self.cv = KFold(
          n_splits=n_fold, shuffle=True, random_state=random_state
      )
      self.calibration = calibration
  
      self._y_pred, self._tau_pred, self._w_pred, self._dr_score = (
          None,
          None,
          None,
          None,
      )
  
file_path: causalml/causalml/optimize/policylearner.py
imports: import logging
  import numpy
  from causalml.propensity import compute_propensity_score
  from sklearn.ensemble import GradientBoostingRegressor, GradientBoostingClassifier
  from sklearn.model_selection import cross_val_predict, KFold
  from sklearn.tree import DecisionTreeClassifier
label_desc: Use image node_id 1 to create a new PolicyLearner object from inherited base classes: object with example: obj = PolicyLearner(outcome_learner, treatment_learner, policy_learner, clip_bounds, n_fold, random_state, calibration)