Skip to content

Expose CATE estimation and inference methods on DRPolicyForest/Tree#1024

Open
jcharit1 wants to merge 1 commit intopy-why:mainfrom
jcharit1:feature/expose-cate-inference-on-drpolicy
Open

Expose CATE estimation and inference methods on DRPolicyForest/Tree#1024
jcharit1 wants to merge 1 commit intopy-why:mainfrom
jcharit1:feature/expose-cate-inference-on-drpolicy

Conversation

@jcharit1
Copy link
Copy Markdown

Summary

  • DRPolicyForest and DRPolicyTree internally fit a DRLearner but do not expose its CATE estimation and inference API (e.g., effect(), effect_inference(), effect_interval(), shap_values(), score())
  • Users who need both optimal policy assignments and CATE confidence intervals may consider strategies such as a 3-way data split, which can be less data-efficient
  • EconML's cross-fitting within DRPolicyForest already provides noise separation between CATE estimation and policy learning — exposing the underlying CATE inference methods enables a more data-efficient 2-split workflow

Changes

  • Add delegation methods on _BaseDRPolicyLearner for effect(), effect_interval(), effect_inference(), const_marginal_effect(), const_marginal_effect_interval(), const_marginal_effect_inference(), marginal_effect(), ate(), ate_interval(), ate_inference(), shap_values(), score(), and model_final_
  • Pass inference parameter through _BaseDRPolicyLearner.fit() to the underlying DRLearner
  • Fit per-treatment RegressionForest CATE models alongside the policy model in _PolicyModelFinal to support GenericModelFinalInferenceDiscrete
  • Override _get_inference_options in _DRLearnerWrapper to enable automatic inference when CATE models are available

Motivation

When learning personalization policies from A/B test data, a natural workflow is:

  1. Learn optimal treatment assignments using DRPolicyForest
  2. Estimate CATEs with confidence intervals for the policy-assigned treatments

Without this change, users must manually split data across separate ForestDRLearner and DRPolicyForest fits, losing the data efficiency that EconML's built-in cross-fitting provides.

Test plan

  • All 10 existing test_policy_forest.py tests pass
  • All 234 non-Ray tests in the full suite pass (0 regressions)
  • Verified effect(), effect_inference(), effect_interval(), const_marginal_effect_inference(), shap_values(), score() all work on DRPolicyForest after the change
  • Verified inference produces valid point estimates, standard errors, p-values, and confidence intervals

🤖 Generated with Claude Code

DRPolicyForest and DRPolicyTree internally fit a DRLearner but do not
expose its CATE estimation and inference API. Users who need both
optimal policy assignments and CATE confidence intervals may consider
strategies such as a 3-way data split:

  1. Data for learning CATEs (ForestDRLearner)
  2. Data for learning policies (DRPolicyForest using out-of-sample rewards)
  3. Data for out-of-sample evaluation with CIs

While statistically valid, this approach can be less data-efficient.
EconML's cross-fitting within DRPolicyForest already provides noise
separation between CATE estimation and policy learning, which could
allow users to consolidate the first two splits. Exposing the
underlying CATE inference methods enables this more data-efficient
workflow.

Changes:
- Add delegation methods on _BaseDRPolicyLearner for effect(),
  effect_interval(), effect_inference(), const_marginal_effect(),
  const_marginal_effect_interval(), const_marginal_effect_inference(),
  marginal_effect(), ate(), ate_interval(), ate_inference(),
  shap_values(), score(), and model_final_
- Pass inference parameter through _BaseDRPolicyLearner.fit() to the
  underlying DRLearner
- Fit per-treatment RegressionForest CATE models alongside the policy
  model in _PolicyModelFinal to support GenericModelFinalInferenceDiscrete
- Override _get_inference_options in _DRLearnerWrapper to enable
  automatic inference when CATE models are available

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Jimmy Charité <jimmy.charite@gmail.com>
@jcharit1 jcharit1 force-pushed the feature/expose-cate-inference-on-drpolicy branch from d65213c to af02ab9 Compare March 24, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant