Skip to content

Commit

Permalink
Merge branch 'main' into 319-better-error-for-columnstability-if-the-…
Browse files Browse the repository at this point in the history
…column-contains-only-null-values
  • Loading branch information
alex-senger authored Jun 23, 2023
2 parents 35e9df8 + d97d32a commit 5f21368
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/megalinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ jobs:
contents: write
issues: write
pull-requests: write
secrets:
PAT: ${{ secrets.PAT }}
10 changes: 10 additions & 0 deletions src/safeds/data/tabular/containers/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Table:
| [from_columns][safeds.data.tabular.containers._table.Table.from_columns] | Create a table from a list of columns. |
| [from_rows][safeds.data.tabular.containers._table.Table.from_rows] | Create a table from a list of rows. |
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
data : Mapping[str, Sequence[Any]] | None
Expand Down Expand Up @@ -825,6 +827,8 @@ def keep_only_columns(self, column_names: list[str]) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
column_names : list[str]
Expand Down Expand Up @@ -857,6 +861,8 @@ def remove_columns(self, column_names: list[str]) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Parameters
----------
column_names : list[str]
Expand Down Expand Up @@ -889,6 +895,8 @@ def remove_columns_with_missing_values(self) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Returns
-------
table : Table
Expand All @@ -902,6 +910,8 @@ def remove_columns_with_non_numerical_values(self) -> Table:
This table is not modified.
Note: When removing the last column of the table, the `number_of_columns` property will be set to 0.
Returns
-------
table : Table
Expand Down
6 changes: 3 additions & 3 deletions src/safeds/ml/classical/classification/_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions tests/safeds/ml/classical/classification/test_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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]

0 comments on commit 5f21368

Please sign in to comment.