Skip to content

Commit 7e7b5b4

Browse files
authored
temporarily disable report in score mode when using with_scoring (skrub-data#2054)
1 parent 4ee61ed commit 7e7b5b4

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

skrub/_data_ops/_estimator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ def report(self, *, environment, mode, **full_report_kwargs):
266266
>>> predict_results['result'] # doctest: +SKIP
267267
array([0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0])
268268
"""
269+
if mode == "score" and find_scoring_node(self.data_op) is not None:
270+
raise NotImplementedError(
271+
"Creating the report for 'score' mode when .skb.with_scoring() "
272+
"has been used is not implemented yet."
273+
)
269274
from ._inspection import full_report
270275

271276
if mode not in _FITTING_METHODS:

skrub/_data_ops/tests/test_inspection.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ def test_report_fit_mode():
115115
assert "olleh" in node_1_report
116116

117117

118+
def test_report_score_mode_with_scoring():
119+
learner = (
120+
skrub.X()
121+
.skb.apply(DummyClassifier(), y=skrub.y())
122+
.skb.with_scoring("accuracy")
123+
.skb.make_learner()
124+
)
125+
with pytest.raises(
126+
NotImplementedError,
127+
match=re.escape(
128+
"Creating the report for 'score' mode when .skb.with_scoring() "
129+
"has been used is not implemented yet."
130+
),
131+
):
132+
learner.report(environment={}, mode="score")
133+
134+
118135
@pytest.mark.skipif(not _inspection._has_graphviz(), reason="report requires graphviz")
119136
def test_full_report_open(monkeypatch):
120137
mock = Mock()

0 commit comments

Comments
 (0)