Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skore-hub-project/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ addopts = [
"--verbosity=2",
"--dist=loadscope",
]
filterwarnings = ["error"]

[tool.coverage.run]
branch = true
Expand Down
6 changes: 2 additions & 4 deletions skore-hub-project/src/skore_hub_project/metric/precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class PrecisionTest(Precision): # noqa: D101

class PrecisionMean(CrossValidationReportMetric): # noqa: D101
accessor: ClassVar[str] = "metrics.precision"
aggregate: ClassVar[Literal["mean"]] = "mean"
name: str = "precision_mean"
verbose_name: str = "Precision (macro) - MEAN"
greater_is_better: bool = True
Expand All @@ -53,7 +52,7 @@ def value(self) -> float | None: # noqa: D102
return None

dataframe = function(
data_source=self.data_source, aggregate=self.aggregate, average="macro"
data_source=self.data_source, aggregate="mean", average="macro"
)

return cast_to_float(dataframe.iloc[0, 0])
Expand All @@ -69,7 +68,6 @@ class PrecisionTestMean(PrecisionMean): # noqa: D101

class PrecisionStd(CrossValidationReportMetric): # noqa: D101
accessor: ClassVar[str] = "metrics.precision"
aggregate: ClassVar[Literal["std"]] = "std"
name: str = "precision_std"
verbose_name: str = "Precision (macro) - STD"
greater_is_better: bool = False
Expand All @@ -84,7 +82,7 @@ def value(self) -> float | None: # noqa: D102
return None

dataframe = function(
data_source=self.data_source, aggregate=self.aggregate, average="macro"
data_source=self.data_source, aggregate="std", average="macro"
)

return cast_to_float(dataframe.iloc[0, 0])
Expand Down
7 changes: 6 additions & 1 deletion skore-hub-project/tests/unit/project/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import joblib
from httpx import Client, Response
from pytest import fixture, raises
from pytest import fixture, mark, raises
from skore import CrossValidationReport, EstimatorReport
from skore_hub_project import Project
from skore_hub_project.report import (
Expand Down Expand Up @@ -128,6 +128,11 @@ def test_put_estimator_report(self, monkeypatch, binary_classification, respx_mo
# Compare content with the desired output
assert content == desired

@mark.filterwarnings(
# ignore precision warning due to the low number of labels in
# `small_cv_binary_classification`, raised by `scikit-learn`
"ignore:Precision is ill-defined.*:sklearn.exceptions.UndefinedMetricWarning"
)
def test_put_cross_validation_report(
self, monkeypatch, small_cv_binary_classification, respx_mock
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ def test_splits_test_samples_density_many_rows(self):
def test_class_names(self, payload):
assert payload.class_names == ["1", "0"]

@mark.filterwarnings(
# ignore `scipy` deprecation warning, raised by `scikit-learn<1.7`
"ignore:scipy.optimize*:DeprecationWarning"
)
def test_classes(self, payload):
X, y = make_classification(
random_state=42,
Expand All @@ -145,6 +149,11 @@ def test_classes(self, payload):
def test_classes_many_rows(self, payload):
assert payload.classes == [0, 0, 1, 1, 1, 0, 0, 1, 0, 1]

@mark.filterwarnings(
# ignore precision warning due to the low number of labels in
# `small_cv_binary_classification`, raised by `scikit-learn`
"ignore:Precision is ill-defined*:sklearn.exceptions.UndefinedMetricWarning"
)
@mark.usefixtures("monkeypatch_artifact_hub_client")
@mark.usefixtures("monkeypatch_upload_routes")
@mark.usefixtures("monkeypatch_upload_with_mock")
Expand Down Expand Up @@ -192,6 +201,11 @@ def test_pickle(
"content_type": "application/octet-stream",
}

@mark.filterwarnings(
# ignore precision warning due to the low number of labels in
# `small_cv_binary_classification`, raised by `scikit-learn`
"ignore:Precision is ill-defined.*:sklearn.exceptions.UndefinedMetricWarning"
)
def test_metrics(self, payload):
assert list(map(type, payload.metrics)) == [
AccuracyTestMean,
Expand Down Expand Up @@ -234,6 +248,11 @@ def test_medias(self, payload):
TableReport,
]

@mark.filterwarnings(
# ignore precision warning due to the low number of labels in
# `small_cv_binary_classification`, raised by `scikit-learn`
"ignore:Precision is ill-defined.*:sklearn.exceptions.UndefinedMetricWarning"
)
@mark.usefixtures("monkeypatch_artifact_hub_client")
@mark.usefixtures("monkeypatch_upload_routes")
def test_model_dump(self, small_cv_binary_classification, payload):
Expand Down