How to use the causallib.evaluation.weight_evaluator.PropensityEvaluatorPredictions function in causallib

To help you get started, we’ve selected a few causallib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / causallib / causallib / evaluation / weight_evaluator.py View on Github external
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
github IBM / causallib / causallib / evaluation / weight_evaluator.py View on Github external
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

causallib

A Python package for flexible and modular causal inference modeling

Apache-2.0
Latest version published 5 months ago

Package Health Score

67 / 100
Full package analysis

Similar packages