Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Args:
X (pd.DataFrame): Covariates.
a (pd.Series): Target variable - treatment assignment
Returns:
PropensityEvaluatorPredictions
"""
propensity = self.estimator.compute_propensity(X, a, treatment_values=a.max())
propensity_by_treatment_assignment = self.estimator.compute_propensity_matrix(X)
propensity_by_treatment_assignment = robust_lookup(propensity_by_treatment_assignment, a)
weight_prediction = super(PropensityEvaluator, self)._estimator_predict(X, a)
# Do not force stabilize=False as in WeightEvaluator:
weight_by_treatment_assignment = self.estimator.compute_weights(X, a)
prediction = PropensityEvaluatorPredictions(weight_by_treatment_assignment,
weight_prediction.weight_for_being_treated,
weight_prediction.treatment_assignment_pred,
propensity,
propensity_by_treatment_assignment)
return prediction
def __init__(self, weight_by_treatment_assignment, weight_for_being_treated, treatment_assignment_pred,
propensity, propensity_by_treatment_assignment):
super(PropensityEvaluatorPredictions, self).__init__(weight_by_treatment_assignment,
weight_for_being_treated,
treatment_assignment_pred)
self.propensity = propensity
self.propensity_by_treatment_assignment = propensity_by_treatment_assignment