8000 DOC - Ensure that SGDOneClassSVM pass numpydoc validation (#21105) · glemaitre/scikit-learn@bcd84c1 · GitHub
[go: up one dir, main page]

Skip to content

Commit bcd84c1

Browse files
EricEllwangerfrellwan
authored andcommitted
DOC - Ensure that SGDOneClassSVM pass numpydoc validation (scikit-learn#21105)
Co-authored-by: frellwan <frellwan@hotmail.com>
1 parent 3cded27 commit bcd84c1

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
"QuadraticDiscriminantAnalysis",
3535
"RandomizedSearchCV",
3636
"RobustScaler",
37-
"SGDOneClassSVM",
3837
"SGDRegressor",
3938
"SelfTrainingClassifier",
4039
"SparseRandomProjection",

sklearn/linear_model/_stochastic_gradient.py

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,8 +1975,8 @@ class SGDOneClassSVM(BaseSGD, OutlierMixin):
19751975
Whether or not the training data should be shuffled after each epoch.
19761976
Defaults to True.
19771977
1978-
verbose : integer, optional
1979-
The verbosity level
1978+
verbose : int, optional
1979+
The verbosity level.
19801980
19811981
random_state : int, RandomState instance or None, optional (default=None)
19821982
The seed of the pseudo random number generator to use when shuffling
@@ -1985,7 +1985,7 @@ class SGDOneClassSVM(BaseSGD, OutlierMixin):
19851985
generator; If None, the random number generator is the RandomState
19861986
instance used by `np.random`.
19871987
1988-
learning_rate : string, optional
1988+
learning_rate : str, optional
19891989
The learning rate schedule to use with `fit`. (If using `partial_fit`,
19901990
learning rate must be controlled directly).
19911991
@@ -2059,6 +2059,17 @@ class SGDOneClassSVM(BaseSGD, OutlierMixin):
20592059
20602060
.. versionadded:: 1.0
20612061
2062+
See Also
2063+
--------
2064+
sklearn.svm.OneClassSVM : Unsupervised Outlier Detection.
2065+
2066+
Notes
2067+
-----
2068+
This estimator has a linear complexity in the number of training samples
2069+
and is thus better suited than the `sklearn.svm.OneClassSVM`
2070+
implementation for datasets with a large number of training samples (say
2071+
> 10,000).
2072+
20622073
Examples
20632074
--------
20642075
>>> import numpy as np
@@ -2070,17 +2081,6 @@ class SGDOneClassSVM(BaseSGD, OutlierMixin):
20702081
20712082
>>> print(clf.predict([[4, 4]]))
20722083
[1]
2073-
2074-
See also
2075-
--------
2076-
sklearn.svm.OneClassSVM
2077-
2078-
Notes
2079-
-----
2080-
This estimator has a linear complexity in the number of training samples
2081-
and is thus better suited than the `sklearn.svm.OneClassSVM`
2082-
implementation for datasets with a large number of training samples (say
2083-
> 10,000).
20842084
"""
20852085

20862086
loss_functions = {"hinge": (Hinge, 1.0)}
@@ -2295,14 +2295,17 @@ def partial_fit(self, X, y=None, sample_weight=None):
22952295
----------
22962296
X : {array-like, sparse matrix}, shape (n_samples, n_features)
22972297
Subset of the training data.
2298+
y : Ignored
2299+
Not used, present for API consistency by convention.
22982300
22992301
sample_weight : array-like, shape (n_samples,), optional
23002302
Weights applied to individual samples.
23012303
If not provided, uniform weights are assumed.
23022304
23032305
Returns
23042306
-------
2305-
self : returns an instance of self.
2307+
self : object
2308+
Returns a fitted instance of self.
23062309
"""
23072310

23082311
alpha = self.nu / 2
@@ -2383,6 +2386,8 @@ def fit(self, X, y=None, coef_init=None, offset_init=None, sample_weight=None):
23832386
----------
23842387
X : {array-like, sparse matrix}, shape (n_samples, n_features)
23852388
Training data.
2389+
y : Ignored
2390+
Not used, present for API consistency by convention.
23862391
23872392
coef_init : array, shape (n_classes, n_features)
23882393
The initial coefficients to warm-start the optimization.
@@ -2398,7 +2403,8 @@ def fit(self, X, y=None, coef_init=None, offset_init=None, sample_weight=None):
23982403
23992404
Returns
24002405
-------
2401-
self : returns an instance of self.
2406+
self : object
2407+
Returns a fitted instance of self.
24022408
"""
24032409

24042410
alpha = self.nu / 2

0 commit comments

Comments
 (0)
0