Skip to content

Commit 357c05c

Browse files
NicolasHugjnothman
authored andcommitted
DOC/TST Docstring checks for svm and covariance modules (scikit-learn#11405)
1 parent 8424dd1 commit 357c05c

File tree

5 files changed

+60
-60
lines changed

5 files changed

+60
-60
lines changed

sklearn/covariance/elliptic_envelope.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def decision_function(self, X, raw_values=None):
122122
decision function. Must be False (default) for compatibility
123123
with the others outlier detection tools.
124124
125-
.. deprecated:: 0.20
126-
``raw_values`` has been deprecated in 0.20 and will be removed
127-
in 0.22.
125+
.. deprecated:: 0.20
126+
``raw_values`` has been deprecated in 0.20 and will be removed
127+
in 0.22.
128128
129129
Returns
130130
-------

sklearn/covariance/graph_lasso_.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ def graphical_lasso_path(X, alphas, cov_init=None, X_test=None, mode='cd',
383383
alphas : list of positive floats
384384
The list of regularization parameters, decreasing order.
385385
386+
cov_init : 2D array (n_features, n_features), optional
387+
The initial guess for the covariance.
388+
386389
X_test : 2D array, shape (n_test_samples, n_features), optional
387390
Optional test matrix to measure generalisation error.
388391

sklearn/covariance/robust_covariance.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ def c_step(X, n_support, remaining_iterations=30, initial_estimates=None,
5555
verbose : boolean, optional
5656
Verbose mode.
5757
58+
cov_computation_method : callable, default empirical_covariance
59+
The function which will be used to compute the covariance.
60+
Must return shape (n_features, n_features)
61+
5862
random_state : int, RandomState instance or None, optional (default=None)
5963
If int, random_state is the seed used by the random number generator;
6064
If RandomState instance, random_state is the random number generator;
6165
If None, the random number generator is the RandomState instance used
6266
by `np.random`.
6367
64-
cov_computation_method : callable, default empirical_covariance
65-
The function which will be used to compute the covariance.
66-
Must return shape (n_features, n_features)
67-
6868
Returns
6969
-------
7070
location : array-like, shape (n_features,)
@@ -200,9 +200,6 @@ def select_candidates(X, n_support, n_trials, select=1, n_iter=30,
200200
n_support : int, [(n + p + 1)/2] < n_support < n
201201
The number of samples the pure data set must contain.
202202
203-
select : int, int > 0
204-
Number of best candidates results to return.
205-
206203
n_trials : int, nb_trials > 0 or 2-tuple
207204
Number of different initial sets of observations from which to
208205
run the algorithm.
@@ -214,22 +211,25 @@ def select_candidates(X, n_support, n_trials, select=1, n_iter=30,
214211
- n_trials[1]: array-like, shape (n_trials, n_features, n_features)
215212
is the list of `n_trials` initial covariances estimates
216213
214+
select : int, int > 0
215+
Number of best candidates results to return.
216+
217217
n_iter : int, nb_iter > 0
218218
Maximum number of iterations for the c_step procedure.
219219
(2 is enough to be close to the final solution. "Never" exceeds 20).
220220
221-
random_state : int, RandomState instance or None, optional (default=None)
222-
If int, random_state is the seed used by the random number generator;
223-
If RandomState instance, random_state is the random number generator;
224-
If None, the random number generator is the RandomState instance used
225-
by `np.random`.
221+
verbose : boolean, default False
222+
Control the output verbosity.
226223
227224
cov_computation_method : callable, default empirical_covariance
228225
The function which will be used to compute the covariance.
229226
Must return shape (n_features, n_features)
230227
231-
verbose : boolean, default False
232-
Control the output verbosity.
228+
random_state : int, RandomState instance or None, optional (default=None)
229+
If int, random_state is the seed used by the random number generator;
230+
If RandomState instance, random_state is the random number generator;
231+
If None, the random number generator is the RandomState instance used
232+
by `np.random`.
233233
234234
See Also
235235
---------

sklearn/svm/classes.py

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -260,26 +260,23 @@ class LinearSVR(LinearModel, RegressorMixin):
260260
261261
Parameters
262262
----------
263-
C : float, optional (default=1.0)
264-
Penalty parameter C of the error term. The penalty is a squared
265-
l2 penalty. The bigger this parameter, the less regularization is used.
266-
267-
loss : string, 'epsilon_insensitive' or 'squared_epsilon_insensitive' (default='epsilon_insensitive')
268-
Specifies the loss function. 'l1' is the epsilon-insensitive loss
269-
(standard SVR) while 'l2' is the squared epsilon-insensitive loss.
270-
271263
epsilon : float, optional (default=0.1)
272264
Epsilon parameter in the epsilon-insensitive loss function. Note
273265
that the value of this parameter depends on the scale of the target
274266
variable y. If unsure, set ``epsilon=0``.
275267
276-
dual : bool, (default=True)
277-
Select the algorithm to either solve the dual or primal
278-
optimization problem. Prefer dual=False when n_samples > n_features.
279-
280268
tol : float, optional (default=1e-4)
281269
Tolerance for stopping criteria.
282270
271+
C : float, optional (default=1.0)
272+
Penalty parameter C of the error term. The penalty is a squared
273+
l2 penalty. The bigger this parameter, the less regularization is used.
274+
275+
loss : string, optional (default='epsilon_insensitive')
276+
Specifies the loss function. The epsilon-insensitive loss
277+
(standard SVR) is the L1 loss, while the squared epsilon-insensitive
278+
loss ('squared_epsilon_insensitive') is the L2 loss.
279+
283280
fit_intercept : boolean, optional (default=True)
284281
Whether to calculate the intercept for this model. If set
285282
to false, no intercept will be used in calculations
@@ -296,6 +293,10 @@ class LinearSVR(LinearModel, RegressorMixin):
296293
To lessen the effect of regularization on synthetic feature weight
297294
(and therefore on the intercept) intercept_scaling has to be increased.
298295
296+
dual : bool, (default=True)
297+
Select the algorithm to either solve the dual or primal
298+
optimization problem. Prefer dual=False when n_samples > n_features.
299+
299300
verbose : int, (default=0)
300301
Enable verbose output. Note that this setting takes advantage of a
301302
per-process runtime setting in liblinear that, if enabled, may not work
@@ -473,13 +474,13 @@ class SVC(BaseSVC):
473474
Independent term in kernel function.
474475
It is only significant in 'poly' and 'sigmoid'.
475476
477+
shrinking : boolean, optional (default=True)
478+
Whether to use the shrinking heuristic.
479+
476480
probability : boolean, optional (default=False)
477481
Whether to enable probability estimates. This must be enabled prior
478482
to calling `fit`, and will slow down that method.
479483
480-
shrinking : boolean, optional (default=True)
481-
Whether to use the shrinking heuristic.
482-
483484
tol : float, optional (default=1e-3)
484485
Tolerance for stopping criterion.
485486
@@ -639,13 +640,13 @@ class NuSVC(BaseSVC):
639640
Independent term in kernel function.
640641
It is only significant in 'poly' and 'sigmoid'.
641642
643+
shrinking : boolean, optional (default=True)
644+
Whether to use the shrinking heuristic.
645+
642646
probability : boolean, optional (default=False)
643647
Whether to enable probability estimates. This must be enabled prior
644648
to calling `fit`, and will slow down that method.
645649
646-
shrinking : boolean, optional (default=True)
647-
Whether to use the shrinking heuristic.
648-
649650
tol : float, optional (default=1e-3)
650651
Tolerance for stopping criterion.
651652
@@ -769,15 +770,6 @@ class SVR(BaseLibSVM, RegressorMixin):
769770
770771
Parameters
771772
----------
772-
C : float, optional (default=1.0)
773-
Penalty parameter C of the error term.
774-
775-
epsilon : float, optional (default=0.1)
776-
Epsilon in the epsilon-SVR model. It specifies the epsilon-tube
777-
within which no penalty is associated in the training loss function
778-
with points predicted within a distance epsilon from the actual
779-
value.
780-
781773
kernel : string, optional (default='rbf')
782774
Specifies the kernel type to be used in the algorithm.
783775
It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or
@@ -803,12 +795,21 @@ class SVR(BaseLibSVM, RegressorMixin):
803795
Independent term in kernel function.
804796
It is only significant in 'poly' and 'sigmoid'.
805797
806-
shrinking : boolean, optional (default=True)
807-
Whether to use the shrinking heuristic.
808-
809798
tol : float, optional (default=1e-3)
810799
Tolerance for stopping criterion.
811800
801+
C : float, optional (default=1.0)
802+
Penalty parameter C of the error term.
803+
804+
epsilon : float, optional (default=0.1)
805+
Epsilon in the epsilon-SVR model. It specifies the epsilon-tube
806+
within which no penalty is associated in the training loss function
807+
with points predicted within a distance epsilon from the actual
808+
value.
809+
810+
shrinking : boolean, optional (default=True)
811+
Whether to use the shrinking heuristic.
812+
812813
cache_size : float, optional
813814
Specify the size of the kernel cache (in MB).
814815
@@ -894,14 +895,14 @@ class NuSVR(BaseLibSVM, RegressorMixin):
894895
895896
Parameters
896897
----------
897-
C : float, optional (default=1.0)
898-
Penalty parameter C of the error term.
899-
900898
nu : float, optional
901899
An upper bound on the fraction of training errors and a lower bound of
902900
the fraction of support vectors. Should be in the interval (0, 1]. By
903901
default 0.5 will be taken.
904902
903+
C : float, optional (default=1.0)
904+
Penalty parameter C of the error term.
905+
905906
kernel : string, optional (default='rbf')
906907
Specifies the kernel type to be used in the algorithm.
907908
It must be one of 'linear', 'poly', 'rbf', 'sigmoid', 'precomputed' or
@@ -1020,12 +1021,6 @@ class OneClassSVM(BaseLibSVM, OutlierMixin):
10201021
If none is given, 'rbf' will be used. If a callable is given it is
10211022
used to precompute the kernel matrix.
10221023
1023-
nu : float, optional
1024-
An upper bound on the fraction of training
1025-
errors and a lower bound of the fraction of support
1026-
vectors. Should be in the interval (0, 1]. By default 0.5
1027-
will be taken.
1028-
10291024
degree : int, optional (default=3)
10301025
Degree of the polynomial kernel function ('poly').
10311026
Ignored by all other kernels.
@@ -1047,6 +1042,12 @@ class OneClassSVM(BaseLibSVM, OutlierMixin):
10471042
tol : float, optional
10481043
Tolerance for stopping criterion.
10491044
1045+
nu : float, optional
1046+
An upper bound on the fraction of training
1047+
errors and a lower bound of the fraction of support
1048+
vectors. Should be in the interval (0, 1]. By default 0.5
1049+
will be taken.
1050+
10501051
shrinking : boolean, optional
10511052
Whether to use the shrinking heuristic.
10521053

sklearn/tests/test_docstring_parameters.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
# TODO Uncomment all modules and fix doc inconsistencies everywhere
2626
# The list of modules that are not tested for now
2727
IGNORED_MODULES = (
28-
'cross_decomposition',
29-
'covariance',
3028
'cluster',
3129
'datasets',
3230
'decomposition',
@@ -41,9 +39,7 @@
4139
'kernel_approximation',
4240
'model_selection',
4341
'multioutput',
44-
'random_projection',
4542
'setup',
46-
'svm',
4743
'utils',
4844
'neighbors',
4945
# Deprecated modules

0 commit comments

Comments
 (0)