rlearner_score still requires outcome_learner while its siblings default to LightGBM
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6k
- Forks
- 877
- PR merge metrics
- No merged PRs in 30d
Description
#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: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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
In causalml/metrics/cate_scoring.py, inspect rlearner_score around lines 499-582 and compare its outcome_learner default and validation with the sibling metrics. Update the requested default and replace the specified bare asserts, including the sibling locations if taking that scope. Done means calls without outcome_learner use the default and invalid inputs raise ValueError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100