Skip to content

Commit

Permalink
Merge branch 'main' into is/1264
Browse files Browse the repository at this point in the history
  • Loading branch information
auguste-probabl authored Feb 17, 2025
2 parents 1215dd9 + c869c6c commit da8cc9d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 18 deletions.
25 changes: 10 additions & 15 deletions skore/src/skore/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ class Project:
Examples
--------
>>>
>> import skore
>>
>> project = skore.Project("my-xp")
>> project.put("score", 1.0)
>> project.get("score")
>>> import skore
>>> project = skore.Project("my-xp")
>>> project.put("score", 1.0)
>>> project.get("score")
1.0
"""

Expand Down Expand Up @@ -272,10 +270,9 @@ def set_note(self, key: str, note: str, *, version=-1):
Examples
--------
# Annotate latest version of key "key"
>>> # Annotate latest version of key "key"
>>> project.set_note("key", "note") # doctest: +SKIP
# Annotate first version of key "key"
>>> # Annotate first version of key "key"
>>> project.set_note("key", "note", version=0) # doctest: +SKIP
"""
return self._item_repository.set_item_note(key=key, note=note, version=version)
Expand All @@ -302,10 +299,9 @@ def get_note(self, key: str, *, version=-1) -> Union[str, None]:
Examples
--------
# Retrieve note attached to latest version of key "key"
>>> # Retrieve note attached to latest version of key "key"
>>> project.get_note("key") # doctest: +SKIP
# Retrieve note attached to first version of key "key"
>>> # Retrieve note attached to first version of key "key"
>>> project.get_note("key", version=0) # doctest: +SKIP
"""
return self._item_repository.get_item_note(key=key, version=version)
Expand All @@ -330,10 +326,9 @@ def delete_note(self, key: str, *, version=-1):
Examples
--------
# Delete note attached to latest version of key "key"
>>> # Delete note attached to latest version of key "key"
>>> project.delete_note("key") # doctest: +SKIP
# Delete note attached to first version of key "key"
>>> # Delete note attached to first version of key "key"
>>> project.delete_note("key", version=0) # doctest: +SKIP
"""
return self._item_repository.delete_item_note(key=key, version=version)
Expand Down
4 changes: 2 additions & 2 deletions skore/src/skore/sklearn/_cross_validation/metrics_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,11 +790,11 @@ def _format_method_name(self, name):
"icon"
] in ("(↗︎)", "(↘︎)"):
if self._SCORE_OR_LOSS_INFO[name]["icon"] == "(↗︎)":
method_name += f"[cyan]{self._SCORE_OR_LOSS_INFO[name]['name']}[/cyan]"
method_name += f"[cyan]{self._SCORE_OR_LOSS_INFO[name]['icon']}[/cyan]"
return method_name.ljust(43)
else: # (↘︎)
method_name += (
f"[orange1]{self._SCORE_OR_LOSS_INFO[name]['name']}[/orange1]"
f"[orange1]{self._SCORE_OR_LOSS_INFO[name]['icon']}[/orange1]"
)
return method_name.ljust(49)
else:
Expand Down
1 change: 0 additions & 1 deletion skore/src/skore/sklearn/_plot/prediction_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ def plot(
else:
self.line_ = ax.plot(x_range_perfect_pred, [0, 0], **perfect_line_kwargs)[0]
ax.set(
aspect="equal",
xlim=x_range_perfect_pred,
ylim=y_range_perfect_pred,
xticks=np.linspace(
Expand Down
6 changes: 6 additions & 0 deletions skore/tests/unit/sklearn/plot/test_prediction_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def test_prediction_error_display_regression(pyplot, regression_data, subsample)
assert display.ax_.get_xlabel() == "Predicted values"
assert display.ax_.get_ylabel() == "Residuals (actual - predicted)"

assert display.ax_.get_aspect() not in ("equal", 1.0)


def test_prediction_error_cross_validation_display_regression(
pyplot, regression_data_no_split
Expand Down Expand Up @@ -105,6 +107,8 @@ def test_prediction_error_cross_validation_display_regression(
assert display.ax_.get_xlabel() == "Predicted values"
assert display.ax_.get_ylabel() == "Residuals (actual - predicted)"

assert display.ax_.get_aspect() not in ("equal", 1.0)


def test_prediction_error_display_regression_kind(pyplot, regression_data):
"""Check the attributes when switching to the "actual_vs_predicted" kind."""
Expand Down Expand Up @@ -164,6 +168,8 @@ def test_prediction_error_cross_validation_display_regression_kind(
assert display.ax_.get_xlabel() == "Predicted values"
assert display.ax_.get_ylabel() == "Actual values"

assert display.ax_.get_aspect() in ("equal", 1.0)


def test_prediction_error_display_data_source(pyplot, regression_data):
"""Check that we can pass the `data_source` argument to the prediction error
Expand Down
5 changes: 5 additions & 0 deletions skore/tests/unit/sklearn/test_cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ def test_cross_validation_report_help(capsys, binary_classification_data):
captured = capsys.readouterr()
assert f"Tools to diagnose estimator {estimator.__class__.__name__}" in captured.out

# Check that we have a line with accuracy and the arrow associated with it
assert re.search(
r"\.accuracy\([^)]*\).*\(↗︎\).*-.*accuracy", captured.out, re.MULTILINE
)


def test_cross_validation_report_repr(binary_classification_data):
"""Check that __repr__ returns a string starting with the expected prefix."""
Expand Down
5 changes: 5 additions & 0 deletions skore/tests/unit/sklearn/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ def test_estimator_report_help(capsys, binary_classification_data):
captured = capsys.readouterr()
assert f"Tools to diagnose estimator {estimator.__class__.__name__}" in captured.out

# Check that we have a line with accuracy and the arrow associated with it
assert re.search(
r"\.accuracy\([^)]*\).*\(↗︎\).*-.*accuracy", captured.out, re.MULTILINE
)


def test_estimator_report_repr(binary_classification_data):
"""Check that __repr__ returns a string starting with the expected prefix."""
Expand Down

0 comments on commit da8cc9d

Please # to comment.