Skip to content

Commit

Permalink
linter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerhardsa0 committed Jul 15, 2024
1 parent b5c3c8d commit d5527a6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tests/safeds/ml/nn/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
@pytest.mark.parametrize("device", get_devices(), ids=get_devices_ids())
class TestClassificationModel:
class TestFit:
def test_should_return_input_size(self) -> None:
def test_should_return_input_size(self, device: Device) -> None:
model = NeuralNetworkClassifier(
InputConversionTable(),
[ForwardLayer(neuron_count=1)],
).fit(
Table.from_dict({"a": [1], "b": [2]}).to_tabular_dataset("a"),
)

device.type
assert model.input_size == 1

def test_should_raise_if_epoch_size_out_of_bounds(self, device: Device) -> None:
Expand Down Expand Up @@ -256,14 +256,15 @@ def callback_was_called(self) -> bool:
assert obj.callback_was_called() is True

class TestFitByExhaustiveSearch:
def test_should_return_input_size(self) -> None:
def test_should_return_input_size(self, device: Device) -> None:
model = NeuralNetworkClassifier(
InputConversionTable(),
[ForwardLayer(neuron_count=Choice(2, 4)), ForwardLayer(1)],
).fit_by_exhaustive_search(
Table.from_dict({"a": [1, 2, 3, 4], "b": [0, 1, 0, 1]}).to_tabular_dataset("b"),
"accuracy",
)
device.type
assert model.input_size == 1

def test_should_raise_if_epoch_size_out_of_bounds_when_fitting_by_exhaustive_search(
Expand Down Expand Up @@ -609,14 +610,14 @@ def test_should_be_pickleable(self, device: Device) -> None:
@pytest.mark.parametrize("device", get_devices(), ids=get_devices_ids())
class TestRegressionModel:
class TestFit:
def test_should_return_input_size(self) -> None:
def test_should_return_input_size(self, device: Device) -> None:
model = NeuralNetworkRegressor(
InputConversionTable(),
[ForwardLayer(neuron_count=1)],
).fit(
Table.from_dict({"a": [1], "b": [2]}).to_tabular_dataset("a"),
)

device.type
assert model.input_size == 1

def test_should_raise_if_epoch_size_out_of_bounds(self, device: Device) -> None:
Expand Down Expand Up @@ -800,14 +801,15 @@ def callback_was_called(self) -> bool:
assert obj.callback_was_called() is True

class TestFitByExhaustiveSearch:
def test_should_return_input_size(self) -> None:
def test_should_return_input_size(self, device: Device) -> None:
model = NeuralNetworkRegressor(
InputConversionTable(),
[ForwardLayer(neuron_count=Choice(2, 4)), ForwardLayer(1)],
).fit_by_exhaustive_search(
Table.from_dict({"a": [1, 2, 3, 4], "b": [1.0, 2.0, 3.0, 4.0]}).to_tabular_dataset("b"),
"mean_squared_error",
)
device.type
assert model.input_size == 1

def test_should_raise_if_epoch_size_out_of_bounds_when_fitting_by_exhaustive_search(
Expand Down

0 comments on commit d5527a6

Please sign in to comment.