diff --git a/doc/whats_new/v1.2.rst b/doc/whats_new/v1.2.rst index 5ddc24e0500ad..b9d482277cd8b 100644 --- a/doc/whats_new/v1.2.rst +++ b/doc/whats_new/v1.2.rst @@ -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 `. +- |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 `, :user:`Arisa Y. ` + and :user:`Tim Head `. + :mod:`sklearn.manifold` ....................... diff --git a/sklearn/linear_model/_stochastic_gradient.py b/sklearn/linear_model/_stochastic_gradient.py index 5d7f74bf75d98..c752977ed0195 100644 --- a/sklearn/linear_model/_stochastic_gradient.py +++ b/sklearn/linear_model/_stochastic_gradient.py @@ -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, diff --git a/sklearn/tests/test_common.py b/sklearn/tests/test_common.py index c9e8d8b813a8e..c8e0035b726a7 100644 --- a/sklearn/tests/test_common.py +++ b/sklearn/tests/test_common.py @@ -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."""