#1030 gave compute_dr_pseudo_outcomes (cate_scoring.py:63), dr_score (:275) and plug_in_t_score (:399) a default LGBMRegressor(num_leaves=64, learning_rate=0.05, n_estimators=300, verbose=-1). rlearner_score (:499) was not touched, so outcome_learner (:506) is still required:
from causalml.metrics import rlearner_score
rlearner_score(df, X=X, outcome_col="y", treatment_col="w")
# AssertionError: Either `y_residual_col`/`w_residual_col` (present in df) or `X` and
# `outcome_learner` (to compute residuals internally) must be provided.
The rationale in #1028 — that the sibling metrics in causalml.metrics default to LightGBM — applies to rlearner_score identically, and after #1030 the module is inconsistent with itself.
Two changes, both in causalml/metrics/cate_scoring.py:
- Give
outcome_learner (:506) the same signature default as its three siblings.
- Replace the bare
asserts at :567 and :582 with ValueError. Asserts are stripped under python -O, so the guard silently disappears and the failure resurfaces later as a confusing error inside the residual computation. (dr_score and plug_in_t_score have the same pattern at :350, :364 and :452 — worth converting in the same pass.)
Scope: one module. No behavior change for callers who already pass outcome_learner.
Observed on master (477cd0a).
🤖 Generated with Claude Code
#1030 gave
compute_dr_pseudo_outcomes(cate_scoring.py:63),dr_score(:275) andplug_in_t_score(:399) a defaultLGBMRegressor(num_leaves=64, learning_rate=0.05, n_estimators=300, verbose=-1).rlearner_score(:499) was not touched, sooutcome_learner(:506) is still required:The rationale in #1028 — that the sibling metrics in
causalml.metricsdefault to LightGBM — applies torlearner_scoreidentically, and after #1030 the module is inconsistent with itself.Two changes, both in
causalml/metrics/cate_scoring.py:outcome_learner(:506) the same signature default as its three siblings.asserts at:567and:582withValueError. Asserts are stripped underpython -O, so the guard silently disappears and the failure resurfaces later as a confusing error inside the residual computation. (dr_scoreandplug_in_t_scorehave the same pattern at:350,:364and:452— worth converting in the same pass.)Scope: one module. No behavior change for callers who already pass
outcome_learner.Observed on master (
477cd0a).🤖 Generated with Claude Code