Skip to content

Commit 45ac1ef

Browse files
alexitkesrth
authored andcommitted
DOC Minor fixes for parameter documentation in ridge (scikit-learn#14453)
1 parent b906078 commit 45ac1ef

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

sklearn/linear_model/ridge.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def ridge_regression(X, y, alpha, sample_weight=None, solver='auto',
262262
assumed to be specific to the targets. Hence they must correspond in
263263
number.
264264
265-
sample_weight : float or numpy array of shape [n_samples]
265+
sample_weight : float or numpy array of shape (n_samples,), default=None
266266
Individual weights for each sample. If sample_weight is not None and
267267
solver='auto', the solver will be set to 'cholesky'.
268268
@@ -314,10 +314,10 @@ def ridge_regression(X, y, alpha, sample_weight=None, solver='auto',
314314
by scipy.sparse.linalg. For 'sag' and saga solver, the default value is
315315
1000.
316316
317-
tol : float
317+
tol : float, default=1e-3
318318
Precision of the solution.
319319
320-
verbose : int
320+
verbose : int, default=0
321321
Verbosity level. Setting verbose > 0 will display additional
322322
information depending on the solver used.
323323
@@ -328,21 +328,21 @@ def ridge_regression(X, y, alpha, sample_weight=None, solver='auto',
328328
generator; If None, the random number generator is the RandomState
329329
instance used by `np.random`. Used when ``solver`` == 'sag'.
330330
331-
return_n_iter : boolean, default False
331+
return_n_iter : bool, default=False
332332
If True, the method also returns `n_iter`, the actual number of
333333
iteration performed by the solver.
334334
335335
.. versionadded:: 0.17
336336
337-
return_intercept : boolean, default False
337+
return_intercept : bool, default=False
338338
If True and if X is sparse, the method also returns the intercept,
339339
and the solver is automatically changed to 'sag'. This is only a
340340
temporary fix for fitting the intercept with sparse data. For dense
341341
data, use sklearn.linear_model._preprocess_data before your regression.
342342
343343
.. versionadded:: 0.17
344344
345-
check_input : boolean, default True
345+
check_input : bool, default=True
346346
If False, the input arrays X and y will not be checked.
347347
348348
.. versionadded:: 0.21
@@ -619,7 +619,7 @@ class Ridge(MultiOutputMixin, RegressorMixin, _BaseRidge):
619619
620620
Parameters
621621
----------
622-
alpha : {float, array-like}, shape (n_targets)
622+
alpha : {float, array-like of shape (n_targets,)}, default=1.0
623623
Regularization strength; must be a positive float. Regularization
624624
improves the conditioning of the problem and reduces the variance of
625625
the estimates. Larger values specify stronger regularization.
@@ -628,28 +628,28 @@ class Ridge(MultiOutputMixin, RegressorMixin, _BaseRidge):
628628
assumed to be specific to the targets. Hence they must correspond in
629629
number.
630630
631-
fit_intercept : bool, default True
631+
fit_intercept : bool, default=True
632632
Whether to calculate the intercept for this model. If set
633633
to false, no intercept will be used in calculations
634634
(i.e. data is expected to be centered).
635635
636-
normalize : boolean, optional, default False
636+
normalize : bool, default=False
637637
This parameter is ignored when ``fit_intercept`` is set to False.
638638
If True, the regressors X will be normalized before regression by
639639
subtracting the mean and dividing by the l2-norm.
640640
If you wish to standardize, please use
641641
:class:`sklearn.preprocessing.StandardScaler` before calling ``fit``
642642
on an estimator with ``normalize=False``.
643643
644-
copy_X : boolean, optional, default True
644+
copy_X : bool, default=True
645645
If True, X will be copied; else, it may be overwritten.
646646
647647
max_iter : int, optional
648648
Maximum number of iterations for conjugate gradient solver.
649649
For 'sparse_cg' and 'lsqr' solvers, the default value is determined
650650
by scipy.sparse.linalg. For 'sag' solver, the default value is 1000.
651651
652-
tol : float
652+
tol : float, default=1e-3
653653
Precision of the solution.
654654
655655
solver : {'auto', 'svd', 'cholesky', 'lsqr', 'sparse_cg', 'sag', 'saga'}
@@ -771,34 +771,34 @@ class RidgeClassifier(LinearClassifierMixin, _BaseRidge):
771771
772772
Parameters
773773
----------
774-
alpha : float
774+
alpha : float, default=1.0
775775
Regularization strength; must be a positive float. Regularization
776776
improves the conditioning of the problem and reduces the variance of
777777
the estimates. Larger values specify stronger regularization.
778778
Alpha corresponds to ``C^-1`` in other linear models such as
779779
LogisticRegression or LinearSVC.
780780
781-
fit_intercept : boolean
781+
fit_intercept : bool, default=True
782782
Whether to calculate the intercept for this model. If set to false, no
783783
intercept will be used in calculations (e.g. data is expected to be
784784
already centered).
785785
786-
normalize : boolean, optional, default False
786+
normalize : bool, default=False
787787
This parameter is ignored when ``fit_intercept`` is set to False.
788788
If True, the regressors X will be normalized before regression by
789789
subtracting the mean and dividing by the l2-norm.
790790
If you wish to standardize, please use
791791
:class:`sklearn.preprocessing.StandardScaler` before calling ``fit``
792792
on an estimator with ``normalize=False``.
793793
794-
copy_X : boolean, optional, default True
794+
copy_X : bool, default=True
795795
If True, X will be copied; else, it may be overwritten.
796796
797797
max_iter : int, optional
798798
Maximum number of iterations for conjugate gradient solver.
799799
The default value is determined by scipy.sparse.linalg.
800800
801-
tol : float
801+
tol : float, default=1e-3
802802
Precision of the solution.
803803
804804
class_weight : dict or 'balanced', optional
@@ -843,7 +843,7 @@ class RidgeClassifier(LinearClassifierMixin, _BaseRidge):
843843
.. versionadded:: 0.19
844844
SAGA solver.
845845
846-
random_state : int, RandomState instance or None, optional, default None
846+
random_state : int, RandomState instance or None, default=None
847847
The seed of the pseudo random number generator to use when shuffling
848848
the data. If int, random_state is the seed used by the random number
849849
generator; If RandomState instance, random_state is the random number
@@ -909,7 +909,7 @@ def fit(self, X, y, sample_weight=None):
909909
y : array-like of shape (n_samples,)
910910
Target values
911911
912-
sample_weight : float or numpy array of shape (n_samples,)
912+
sample_weight : {float, array-like of shape (n_samples,)}, default=None
913913
Sample weight.
914914
915915
.. versionadded:: 0.17
@@ -1590,7 +1590,7 @@ class RidgeCV(MultiOutputMixin, RegressorMixin, _BaseRidgeCV):
15901590
15911591
Parameters
15921592
----------
1593-
alphas : numpy array of shape [n_alphas]
1593+
alphas : numpy array of shape (n_alphas,), default=(0.1, 1.0, 10.0)
15941594
Array of alpha values to try.
15951595
Regularization strength; must be a positive float. Regularization
15961596
improves the conditioning of the problem and reduces the variance of
@@ -1599,20 +1599,20 @@ class RidgeCV(MultiOutputMixin, RegressorMixin, _BaseRidgeCV):
15991599
LogisticRegression or LinearSVC.
16001600
If using generalized cross-validation, alphas must be positive.
16011601
1602-
fit_intercept : bool, default True
1602+
fit_intercept : bool, default=True
16031603
Whether to calculate the intercept for this model. If set
16041604
to false, no intercept will be used in calculations
16051605
(i.e. data is expected to be centered).
16061606
1607-
normalize : boolean, optional, default False
1607+
normalize : bool, default=False
16081608
This parameter is ignored when ``fit_intercept`` is set to False.
16091609
If True, the regressors X will be normalized before regression by
16101610
subtracting the mean and dividing by the l2-norm.
16111611
If you wish to standardize, please use
16121612
:class:`sklearn.preprocessing.StandardScaler` before calling ``fit``
16131613
on an estimator with ``normalize=False``.
16141614
1615-
scoring : string, callable or None, optional, default: None
1615+
scoring : string, callable or None, default=None
16161616
A string (see model evaluation documentation) or
16171617
a scorer callable object / function with signature
16181618
``scorer(estimator, X, y)``.
@@ -1704,28 +1704,28 @@ class RidgeClassifierCV(LinearClassifierMixin, _BaseRidgeCV):
17041704
17051705
Parameters
17061706
----------
1707-
alphas : numpy array of shape [n_alphas]
1707+
alphas : numpy array of shape (n_alphas,), default=(0.1, 1.0, 10.0)
17081708
Array of alpha values to try.
17091709
Regularization strength; must be a positive float. Regularization
17101710
improves the conditioning of the problem and reduces the variance of
17111711
the estimates. Larger values specify stronger regularization.
17121712
Alpha corresponds to ``C^-1`` in other linear models such as
17131713
LogisticRegression or LinearSVC.
17141714
1715-
fit_intercept : boolean
1715+
fit_intercept : bool, default=True
17161716
Whether to calculate the intercept for this model. If set
17171717
to false, no intercept will be used in calculations
17181718
(i.e. data is expected to be centered).
17191719
1720-
normalize : boolean, optional, default False
1720+
normalize : bool, default=False
17211721
This parameter is ignored when ``fit_intercept`` is set to False.
17221722
If True, the regressors X will be normalized before regression by
17231723
subtracting the mean and dividing by the l2-norm.
17241724
If you wish to standardize, please use
17251725
:class:`sklearn.preprocessing.StandardScaler` before calling ``fit``
17261726
on an estimator with ``normalize=False``.
17271727
1728-
scoring : string, callable or None, optional, default: None
1728+
scoring : string, callable or None, default=None
17291729
A string (see model evaluation documentation) or
17301730
a scorer callable object / function with signature
17311731
``scorer(estimator, X, y)``.
@@ -1823,7 +1823,7 @@ def fit(self, X, y, sample_weight=None):
18231823
y : array-like, shape (n_samples,)
18241824
Target values. Will be cast to X's dtype if necessary
18251825
1826-
sample_weight : float or numpy array of shape (n_samples,)
1826+
sample_weight : {float, array-like of shape (n_samples,)}, default=None
18271827
Sample weight.
18281828
18291829
Returns

0 commit comments

Comments
 (0)