diff --git a/src/safeds/ml/classical/classification/_classifier.py b/src/safeds/ml/classical/classification/_classifier.py index 71066128a..915ab8f3c 100644 --- a/src/safeds/ml/classical/classification/_classifier.py +++ b/src/safeds/ml/classical/classification/_classifier.py @@ -117,7 +117,7 @@ def accuracy(self, validation_or_test_set: TaggedTable) -> float: return sk_accuracy_score(expected_values._data, predicted_values._data) - def precision(self, validation_or_test_set: TaggedTable, positive_class: Any = 1) -> float: + def precision(self, validation_or_test_set: TaggedTable, positive_class: Any) -> float: """ Compute the classifier's precision on the given data. @@ -154,7 +154,7 @@ def precision(self, validation_or_test_set: TaggedTable, positive_class: Any = 1 return 1.0 return n_true_positives / (n_true_positives + n_false_positives) - def recall(self, validation_or_test_set: TaggedTable, positive_class: Any = 1) -> float: + def recall(self, validation_or_test_set: TaggedTable, positive_class: Any) -> float: """ Compute the classifier's recall on the given data. @@ -191,7 +191,7 @@ def recall(self, validation_or_test_set: TaggedTable, positive_class: Any = 1) - return 1.0 return n_true_positives / (n_true_positives + n_false_negatives) - def f1_score(self, validation_or_test_set: TaggedTable, positive_class: Any = 1) -> float: + def f1_score(self, validation_or_test_set: TaggedTable, positive_class: Any) -> float: """ Compute the classifier's $F_1$-score on the given data. diff --git a/tests/safeds/ml/classical/classification/test_classifier.py b/tests/safeds/ml/classical/classification/test_classifier.py index 311cc5292..d568c8cfd 100644 --- a/tests/safeds/ml/classical/classification/test_classifier.py +++ b/tests/safeds/ml/classical/classification/test_classifier.py @@ -375,7 +375,7 @@ def test_should_return_1_if_never_expected_to_be_positive(self) -> None: ) def test_should_raise_if_table_is_not_tagged(self, table: Table) -> None: with pytest.raises(UntaggedTableError): - DummyClassifier().precision(table) # type: ignore[arg-type] + DummyClassifier().precision(table, 1) # type: ignore[arg-type] class TestRecall: @@ -424,7 +424,7 @@ def test_should_return_1_if_never_expected_to_be_positive(self) -> None: ) def test_should_raise_if_table_is_not_tagged(self, table: Table) -> None: with pytest.raises(UntaggedTableError): - DummyClassifier().recall(table) # type: ignore[arg-type] + DummyClassifier().recall(table, 1) # type: ignore[arg-type] class TestF1Score: @@ -473,4 +473,4 @@ def test_should_return_1_if_never_expected_or_predicted_to_be_positive(self) -> ) def test_should_raise_if_table_is_not_tagged(self, table: Table) -> None: with pytest.raises(UntaggedTableError): - DummyClassifier().f1_score(table) # type: ignore[arg-type] + DummyClassifier().f1_score(table, 1) # type: ignore[arg-type]