8000 ENH Remove validation from `__init__` for `SGDOneClassSVM` (#24433) · scikit-learn/scikit-learn@ad91259 · GitHub
[go: up one dir, main page]

10000
Skip to content

Commit ad91259

Browse files
betatimiofallarisayosh
authored
ENH Remove validation from __init__ for SGDOneClassSVM (#24433)
Co-authored-by: iofall <50991099+iofall@users.noreply.github.com> Co-authored-by: arisayosh <15692997+arisayosh@users.noreply.github.com>
1 parent b79423e commit ad91259

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

doc/whats_new/v1.2.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,12 @@ Changelog
280280
in :class:`linear_model.LogisticRegression`, and will be removed in version 1.4.
281281
Use `None` instead. :pr:`23877` by :user:`Zhehao Liu <MaxwellLZH>`.
282282

283+
- |Fix| :class:`linear_model.SGDOneClassSVM` no longer performs parameter
284+
validation in the constructor. All validation is now handled in `fit()` and
285+
`partial_fit()`.
286+
:pr:`24433` by :user:`Yogendrasingh <iofall>`, :user:`Arisa Y. <arisayosh>`
287+
and :user:`Tim Head <betatim>`.
288+
283289
:mod:`sklearn.manifold`
284290
.......................
285291

sklearn/linear_model/_stochastic_gradient.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,13 +2160,10 @@ def __init__(
21602160
warm_start=False,
21612161
average=False,
21622162
):
2163-
2164-
alpha = nu / 2
21652163
self.nu = nu
21662164
super(SGDOneClassSVM, self).__init__(
21672165
loss="hinge",
21682166
penalty="l2",
2169-
alpha=alpha,
21702167
C=1.0,
21712168
l1_ratio=0,
21722169
fit_intercept=fit_intercept,

sklearn/tests/test_common.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,9 @@ def test_transformers_get_feature_names_out(transformer):
431431
)
432432

433433

434-
VALIDATE_ESTIMATOR_INIT = [
435-
"SGDOneClassSVM",
436-
]
437-
VALIDATE_ESTIMATOR_INIT = set(VALIDATE_ESTIMATOR_INIT)
438-
439-
440434
@pytest.mark.parametrize(
441435
"Estimator",
442-
[est for name, est in all_estimators() if name not in VALIDATE_ESTIMATOR_INIT],
436+
[est for name, est in all_estimators()],
443437
)
444438
def test_estimators_do_not_raise_errors_in_init_or_set_params(Estimator):
445439
"""Check that init or set_param does not raise errors."""

0 commit comments

Comments
 (0)
0