Exemple #1
0
 def score_cpe(self, metric_name, edp: EvaluationDataPage):
     (
         direct_method,
         inverse_propensity,
         doubly_robust,
     ) = self.doubly_robust_estimator.estimate(edp)
     sequential_doubly_robust = self.sequential_doubly_robust_estimator.estimate(edp)
     weighted_doubly_robust = (
         self.weighted_sequential_doubly_robust_estimator.estimate(
             edp, num_j_steps=1, whether_self_normalize_importance_weights=True
         )
     )
     magic = self.weighted_sequential_doubly_robust_estimator.estimate(
         edp,
         num_j_steps=Evaluator.NUM_J_STEPS_FOR_MAGIC_ESTIMATOR,
         whether_self_normalize_importance_weights=True,
     )
     return CpeEstimateSet(
         direct_method=direct_method,
         inverse_propensity=inverse_propensity,
         doubly_robust=doubly_robust,
         sequential_doubly_robust=sequential_doubly_robust,
         weighted_doubly_robust=weighted_doubly_robust,
         magic=magic,
     )
Exemple #2
0
    def score_cpe(self, metric_name, edp: EvaluationDataPage):
        logger.info("Using OPE adapter")
        direct_method = self.ope_dm_estimator.estimate(edp)
        inverse_propensity = self.ope_ips_estimator.estimate(edp)
        doubly_robust = self.ope_dr_estimator.estimate(edp)

        sequential_doubly_robust = self.ope_seq_dr_estimator.estimate(edp)
        weighted_doubly_robust = self.ope_seq_weighted_dr_estimator.estimate(
            edp)
        magic = self.ope_seq_magic_estimator.estimate(edp)
        return CpeEstimateSet(
            direct_method=direct_method,
            inverse_propensity=inverse_propensity,
            doubly_robust=doubly_robust,
            sequential_doubly_robust=sequential_doubly_robust,
            weighted_doubly_robust=weighted_doubly_robust,
            magic=magic,
        )