Skip to content

Commit d4936a0

Browse files
committed
add a warning for the use of a classifier as ml_l
1 parent 33beb68 commit d4936a0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

doubleml/plm/plr.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def __init__(
120120
if ml_l_is_classifier:
121121
if obj_dml_data.binary_outcome:
122122
self._predict_method = {"ml_g": "predict_proba"}
123+
warnings.warn(
124+
f"The ml_l learner {str(ml_l)} was identified as classifier. Fitting an additive probability model."
125+
)
123126
else:
124127
raise ValueError(
125128
f"The ml_l learner {str(ml_l)} was identified as classifier "

doubleml/plm/tests/test_plr_binary_outcome.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def generate_binary_data():
5454
def test_dml_plr_binary_warnings(generate_binary_data, learner_binary, score):
5555
data = generate_binary_data
5656
obj_dml_data = dml.DoubleMLData(data, "y", ["d"])
57-
msg = "The ml_l learner {str(ml_l)} was identified as classifier"
57+
msg = "The ml_l learner .+ was identified as classifier. Fitting an additive probability model."
5858
with pytest.warns(UserWarning, match=msg):
5959
_ = dml.DoubleMLPLR(obj_dml_data, clone(learner_binary), clone(learner_binary), score=score)
6060

0 commit comments

Comments
 (0)