uber / uber/causalml

rlearner_score still requires outcome_learner while its siblings default to LightGBM

Open Beginner friendly
#1,034 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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:

  1. Give outcome_learner (:506) the same signature default as its three siblings.
  2. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.