8000 ENH Remove validation from `__init__` for `SGDOneClassSVM` by betatim · Pull Request #24433 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

ENH Remove validation from __init__ for SGDOneClassSVM #24433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 15, 2022
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
6 changes: 6 additions & 0 deletions doc/whats_new/v1.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ Changelog
in :class:`linear_model.LogisticRegression`, and will be removed in version 1.4.
Use `None` instead. :pr:`23877` by :user:`Zhehao Liu <MaxwellLZH>`.

- |Fix| :class:`linear_model.SGDOneClassSVM` no longer performs parameter
validation in the constructor. All validation is now handled in `fit()` and
`partial_fit()`.
:pr:`24433` by :user:`Yogendrasingh <iofall>`, :user:`Arisa Y. <arisayosh>`
and :user:`Tim Head <betatim>`.

:mod:`sklearn.manifold`
.......................

Expand Down
3 changes: 0 additions & 3 deletions sklearn/linear_model/_stochastic_gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2160,13 +2160,10 @@ def __init__(
warm_start=False,
average=False,
):

alpha = nu / 2
self.nu = nu
super(SGDOneClassSVM, self).__init__(
loss="hinge",
penalty="l2",
alpha=alpha,
C=1.0,
l1_ratio=0,
fit_intercept=fit_intercept,
Expand Down
8 changes: 1 addition & 7 deletions sklearn/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,9 @@ def test_transformers_get_feature_names_out(transformer):
)


VALIDATE_ESTIMATOR_INIT = [
"SGDOneClassSVM",
]
VALIDATE_ESTIMATOR_INIT = set(VALIDATE_ESTIMATOR_INIT)


@pytest.mark.parametrize(
"Estimator",
[est for name, est in all_estimators() if name not in VALIDATE_ESTIMATOR_INIT],
[est for name, est in all_estimators()],
)
def test_estimators_do_not_raise_errors_in_init_or_set_params(Estimator):
"""Check that init or set_param does not raise errors."""
Expand Down
0