Skip to content

Commit

Permalink
test: alpha should be passed to sklearn
Browse files Browse the repository at this point in the history
  • Loading branch information
lars-reimann committed Apr 28, 2023
1 parent 22818e6 commit d103cb2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/safeds/ml/classical/regression/test_ridge_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ def test_should_warn_if_alpha_is_zero() -> None:
RidgeRegression(alpha=0.0)


def test_should_pass_if_alpha_is_passed_to_fitted_regressor() -> None:
regression = RidgeRegression(alpha=1.0)
fitted_regression = regression.fit(Table.from_dict({"A": [1, 2, 4], "B": [1, 2, 3]}).tag_columns("B"))
assert regression.alpha == fitted_regression.alpha
def test_should_pass_alpha_to_fitted_regressor() -> None:
regressor = RidgeRegression(alpha=1.0)
fitted_regressor = regressor.fit(Table.from_dict({"A": [1, 2, 4], "B": [1, 2, 3]}).tag_columns("B"))
assert regressor.alpha == fitted_regressor.alpha


def test_should_pass_alpha_to_sklearn() -> None:
regressor = RidgeRegression(alpha=1.0)
fitted_regressor = regressor.fit(Table.from_dict({"A": [1, 2, 4], "B": [1, 2, 3]}).tag_columns("B"))
assert fitted_regressor._wrapped_regressor is not None
assert fitted_regressor._wrapped_regressor.alpha == fitted_regressor.alpha

0 comments on commit d103cb2

Please sign in to comment.