@@ -30,37 +30,37 @@ def _cholesky_omp(X, y, n_nonzero_coefs, tol=None, copy_X=True,
3030
3131 Parameters
3232 ----------
33- X : array, shape (n_samples, n_features)
33+ X : ndarray of shape (n_samples, n_features)
3434 Input dictionary. Columns are assumed to have unit norm.
3535
36- y : array, shape (n_samples,)
37- Input targets
36+ y : ndarray of shape (n_samples,)
37+ Input targets.
3838
3939 n_nonzero_coefs : int
40- Targeted number of non-zero elements
40+ Targeted number of non-zero elements.
4141
42- tol : float
42+ tol : float, default=None
4343 Targeted squared error, if not None overrides n_nonzero_coefs.
4444
45- copy_X : bool, optional
45+ copy_X : bool, default=True
4646 Whether the design matrix X must be copied by the algorithm. A false
4747 value is only helpful if X is already Fortran-ordered, otherwise a
4848 copy is made anyway.
4949
50- return_path : bool, optional. Default: False
50+ return_path : bool, default= False
5151 Whether to return every value of the nonzero coefficients along the
5252 forward path. Useful for cross-validation.
5353
5454 Returns
5555 -------
56- gamma : array, shape (n_nonzero_coefs,)
57- Non-zero elements of the solution
56+ gamma : ndarray of shape (n_nonzero_coefs,)
57+ Non-zero elements of the solution.
5858
59- idx : array, shape (n_nonzero_coefs,)
59+ idx : ndarray of shape (n_nonzero_coefs,)
6060 Indices of the positions of the elements in gamma within the solution
61- vector
61+ vector.
6262
63- coef : array, shape (n_features, n_nonzero_coefs)
63+ coef : ndarray of shape (n_features, n_nonzero_coefs)
6464 The first k values of column k correspond to the coefficient value
6565 for the active features at that step. The lower left triangle contains
6666 garbage. Only returned if ``return_path=True``.
@@ -145,44 +145,44 @@ def _gram_omp(Gram, Xy, n_nonzero_coefs, tol_0=None, tol=None,
145145
146146 Parameters
147147 ----------
148- Gram : array, shape (n_features, n_features)
149- Gram matrix of the input data matrix
148+ Gram : ndarray of shape (n_features, n_features)
149+ Gram matrix of the input data matrix.
150150
151- Xy : array, shape (n_features,)
152- Input targets
151+ Xy : ndarray of shape (n_features,)
152+ Input targets.
153153
154154 n_nonzero_coefs : int
155- Targeted number of non-zero elements
155+ Targeted number of non-zero elements.
156156
157- tol_0 : float
157+ tol_0 : float, default=None
158158 Squared norm of y, required if tol is not None.
159159
160- tol : float
160+ tol : float, default=None
161161 Targeted squared error, if not None overrides n_nonzero_coefs.
162162
163- copy_Gram : bool, optional
163+ copy_Gram : bool, default=True
164164 Whether the gram matrix must be copied by the algorithm. A false
165165 value is only helpful if it is already Fortran-ordered, otherwise a
166166 copy is made anyway.
167167
168- copy_Xy : bool, optional
168+ copy_Xy : bool, default=True
169169 Whether the covariance vector Xy must be copied by the algorithm.
170170 If False, it may be overwritten.
171171
172- return_path : bool, optional. Default: False
172+ return_path : bool, default= False
173173 Whether to return every value of the nonzero coefficients along the
174174 forward path. Useful for cross-validation.
175175
176176 Returns
177177 -------
178- gamma : array, shape (n_nonzero_coefs,)
179- Non-zero elements of the solution
178+ gamma : ndarray of shape (n_nonzero_coefs,)
179+ Non-zero elements of the solution.
180180
181- idx : array, shape (n_nonzero_coefs,)
181+ idx : ndarray of shape (n_nonzero_coefs,)
182182 Indices of the positions of the elements in gamma within the solution
183- vector
183+ vector.
184184
185- coefs : array, shape (n_features, n_nonzero_coefs)
185+ coefs : ndarray of shape (n_features, n_nonzero_coefs)
186186 The first k values of column k correspond to the coefficient value
187187 for the active features at that step. The lower left triangle contains
188188 garbage. Only returned if ``return_path=True``.
@@ -267,7 +267,7 @@ def _gram_omp(Gram, Xy, n_nonzero_coefs, tol_0=None, tol=None,
267267def orthogonal_mp (X , y , * , n_nonzero_coefs = None , tol = None , precompute = False ,
268268 copy_X = True , return_path = False ,
269269 return_n_iter = False ):
270- r"""Orthogonal Matching Pursuit (OMP)
270+ r"""Orthogonal Matching Pursuit (OMP).
271271
272272 Solves n_targets Orthogonal Matching Pursuit problems.
273273 An instance of the problem has the form:
@@ -283,11 +283,11 @@ def orthogonal_mp(X, y, *, n_nonzero_coefs=None, tol=None, precompute=False,
283283
284284 Parameters
285285 ----------
286- X : array, shape (n_samples, n_features)
286+ X : ndarray of shape (n_samples, n_features)
287287 Input data. Columns are assumed to have unit norm.
288288
289- y : array, shape (n_samples,) or (n_samples, n_targets)
290- Input targets
289+ y : ndarray of shape (n_samples,) or (n_samples, n_targets)
290+ Input targets.
291291
292292 n_nonzero_coefs : int, default=None
293293 Desired number of non-zero entries in the solution. If None (by
@@ -296,7 +296,7 @@ def orthogonal_mp(X, y, *, n_nonzero_coefs=None, tol=None, precompute=False,
296296 tol : float, default=None
297297 Maximum norm of the residual. If not None, overrides n_nonzero_coefs.
298298
299- precompute : {True, False, 'auto'} , default=False
299+ precompute : 'auto' or bool , default=False
300300 Whether to perform precomputations. Improves performance when n_targets
301301 or n_samples is very large.
302302
@@ -314,7 +314,7 @@ def orthogonal_mp(X, y, *, n_nonzero_coefs=None, tol=None, precompute=False,
314314
315315 Returns
316316 -------
317- coef : array, shape (n_features,) or (n_features, n_targets)
317+ coef : ndarray of shape (n_features,) or (n_features, n_targets)
318318 Coefficients of the OMP solution. If `return_path=True`, this contains
319319 the whole coefficient path. In this case its shape is
320320 (n_features, n_features) or (n_features, n_targets, n_features) and
@@ -412,7 +412,7 @@ def orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None,
412412 norms_squared = None , copy_Gram = True ,
413413 copy_Xy = True , return_path = False ,
414414 return_n_iter = False ):
415- """Gram Orthogonal Matching Pursuit (OMP)
415+ """Gram Orthogonal Matching Pursuit (OMP).
416416
417417 Solves n_targets Orthogonal Matching Pursuit problems using only
418418 the Gram matrix X.T * X and the product X.T * y.
@@ -421,11 +421,11 @@ def orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None,
421421
422422 Parameters
423423 ----------
424- Gram : array, shape (n_features, n_features)
425- Gram matrix of the input data: X.T * X
424+ Gram : ndarray of shape (n_features, n_features)
425+ Gram matrix of the input data: X.T * X.
426426
427- Xy : array, shape (n_features,) or (n_features, n_targets)
428- Input targets multiplied by X: X.T * y
427+ Xy : ndarray of shape (n_features,) or (n_features, n_targets)
428+ Input targets multiplied by X: X.T * y.
429429
430430 n_nonzero_coefs : int, default=None
431431 Desired number of non-zero entries in the solution. If None (by
@@ -434,7 +434,7 @@ def orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None,
434434 tol : float, default=None
435435 Maximum norm of the residual. If not None, overrides n_nonzero_coefs.
436436
437- norms_squared : array-like, shape (n_targets,), default=None
437+ norms_squared : array-like of shape (n_targets,), default=None
438438 Squared L2 norms of the lines of y. Required if tol is not None.
439439
440440 copy_Gram : bool, default=True
@@ -455,7 +455,7 @@ def orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None,
455455
456456 Returns
457457 -------
458- coef : array, shape (n_features,) or (n_features, n_targets)
458+ coef : ndarray of shape (n_features,) or (n_features, n_targets)
459459 Coefficients of the OMP solution. If `return_path=True`, this contains
460460 the whole coefficient path. In this case its shape is
461461 (n_features, n_features) or (n_features, n_targets, n_features) and
@@ -544,7 +544,7 @@ def orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None,
544544
545545
546546class OrthogonalMatchingPursuit (MultiOutputMixin , RegressorMixin , LinearModel ):
547- """Orthogonal Matching Pursuit model (OMP)
547+ """Orthogonal Matching Pursuit model (OMP).
548548
549549 Read more in the :ref:`User Guide <omp>`.
550550
@@ -557,32 +557,32 @@ class OrthogonalMatchingPursuit(MultiOutputMixin, RegressorMixin, LinearModel):
557557 tol : float, default=None
558558 Maximum norm of the residual. If not None, overrides n_nonzero_coefs.
559559
560- fit_intercept : boolean , default=True
560+ fit_intercept : bool , default=True
561561 whether to calculate the intercept for this model. If set
562562 to false, no intercept will be used in calculations
563563 (i.e. data is expected to be centered).
564564
565- normalize : boolean , default=True
565+ normalize : bool , default=True
566566 This parameter is ignored when ``fit_intercept`` is set to False.
567567 If True, the regressors X will be normalized before regression by
568568 subtracting the mean and dividing by the l2-norm.
569569 If you wish to standardize, please use
570570 :class:`~sklearn.preprocessing.StandardScaler` before calling ``fit``
571571 on an estimator with ``normalize=False``.
572572
573- precompute : {True, False, 'auto'} , default='auto'
573+ precompute : 'auto' or bool , default='auto'
574574 Whether to use a precomputed Gram and Xy matrix to speed up
575575 calculations. Improves performance when :term:`n_targets` or
576576 :term:`n_samples` is very large. Note that if you already have such
577577 matrices, you can pass them directly to the fit method.
578578
579579 Attributes
580580 ----------
581- coef_ : array, shape (n_features,) or (n_targets, n_features)
582- parameter vector (w in the formula)
581+ coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
582+ Parameter vector (w in the formula).
583583
584- intercept_ : float or array, shape (n_targets,)
585- independent term in decision function.
584+ intercept_ : float or ndarray of shape (n_targets,)
585+ Independent term in decision function.
586586
587587 n_iter_ : int or array-like
588588 Number of active features across every target.
@@ -634,10 +634,10 @@ def fit(self, X, y):
634634
635635 Parameters
636636 ----------
637- X : array-like, shape (n_samples, n_features)
637+ X : array-like of shape (n_samples, n_features)
638638 Training data.
639639
640- y : array-like, shape (n_samples,) or (n_samples, n_targets)
640+ y : array-like of shape (n_samples,) or (n_samples, n_targets)
641641 Target values. Will be cast to X's dtype if necessary
642642
643643
@@ -683,47 +683,47 @@ def fit(self, X, y):
683683
684684def _omp_path_residues (X_train , y_train , X_test , y_test , copy = True ,
685685 fit_intercept = True , normalize = True , max_iter = 100 ):
686- """Compute the residues on left-out data for a full LARS path
686+ """Compute the residues on left-out data for a full LARS path.
687687
688688 Parameters
689689 ----------
690- X_train : array, shape (n_samples, n_features)
691- The data to fit the LARS on
690+ X_train : ndarray of shape (n_samples, n_features)
691+ The data to fit the LARS on.
692692
693- y_train : array, shape (n_samples)
694- The target variable to fit LARS on
693+ y_train : ndarray of shape (n_samples)
694+ The target variable to fit LARS on.
695695
696- X_test : array, shape (n_samples, n_features)
697- The data to compute the residues on
696+ X_test : ndarray of shape (n_samples, n_features)
697+ The data to compute the residues on.
698698
699- y_test : array, shape (n_samples)
700- The target variable to compute the residues on
699+ y_test : ndarray of shape (n_samples)
700+ The target variable to compute the residues on.
701701
702- copy : boolean, optional
702+ copy : bool, default=True
703703 Whether X_train, X_test, y_train and y_test should be copied. If
704704 False, they may be overwritten.
705705
706- fit_intercept : boolean
707- whether to calculate the intercept for this model. If set
706+ fit_intercept : bool, default=True
707+ Whether to calculate the intercept for this model. If set
708708 to false, no intercept will be used in calculations
709709 (i.e. data is expected to be centered).
710710
711- normalize : boolean, optional, default True
711+ normalize : bool, default= True
712712 This parameter is ignored when ``fit_intercept`` is set to False.
713713 If True, the regressors X will be normalized before regression by
714714 subtracting the mean and dividing by the l2-norm.
715715 If you wish to standardize, please use
716716 :class:`~sklearn.preprocessing.StandardScaler` before calling ``fit``
717717 on an estimator with ``normalize=False``.
718718
719- max_iter : integer, optional
719+ max_iter : int, default=100
720720 Maximum numbers of iterations to perform, therefore maximum features
721721 to include. 100 by default.
722722
723723 Returns
724724 -------
725- residues : array, shape (n_samples, max_features)
726- Residues of the prediction on the test data
725+ residues : ndarray of shape (n_samples, max_features)
726+ Residues of the prediction on the test data.
727727 """
728728
729729 if copy :
@@ -767,29 +767,29 @@ class OrthogonalMatchingPursuitCV(RegressorMixin, LinearModel):
767767
768768 Parameters
769769 ----------
770- copy : bool, optional
770+ copy : bool, default=True
771771 Whether the design matrix X must be copied by the algorithm. A false
772772 value is only helpful if X is already Fortran-ordered, otherwise a
773773 copy is made anyway.
774774
775- fit_intercept : boolean, optional
775+ fit_intercept : bool, default=True
776776 whether to calculate the intercept for this model. If set
777777 to false, no intercept will be used in calculations
778778 (i.e. data is expected to be centered).
779779
780- normalize : boolean, optional, default True
780+ normalize : bool, default= True
781781 This parameter is ignored when ``fit_intercept`` is set to False.
782782 If True, the regressors X will be normalized before regression by
783783 subtracting the mean and dividing by the l2-norm.
784784 If you wish to standardize, please use
785785 :class:`~sklearn.preprocessing.StandardScaler` before calling ``fit``
786786 on an estimator with ``normalize=False``.
787787
788- max_iter : integer, optional
788+ max_iter : int, default=None
789789 Maximum numbers of iterations to perform, therefore maximum features
790790 to include. 10% of ``n_features`` but at least 5 if available.
791791
792- cv : int, cross-validation generator or an iterable, optional
792+ cv : int, cross-validation generator or iterable, default=None
793793 Determines the cross-validation splitting strategy.
794794 Possible inputs for cv are:
795795
@@ -806,21 +806,21 @@ class OrthogonalMatchingPursuitCV(RegressorMixin, LinearModel):
806806 .. versionchanged:: 0.22
807807 ``cv`` default value if None changed from 3-fold to 5-fold.
808808
809- n_jobs : int or None, optional ( default=None)
809+ n_jobs : int, default=None
810810 Number of CPUs to use during the cross validation.
811811 ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.
812812 ``-1`` means using all processors. See :term:`Glossary <n_jobs>`
813813 for more details.
814814
815- verbose : boolean or integer, optional
816- Sets the verbosity amount
815+ verbose : bool or int, default=False
816+ Sets the verbosity amount.
817817
818818 Attributes
819819 ----------
820- intercept_ : float or array, shape (n_targets,)
820+ intercept_ : float or ndarray of shape (n_targets,)
821821 Independent term in decision function.
822822
823- coef_ : array, shape (n_features,) or (n_targets, n_features)
823+ coef_ : ndarray of shape (n_features,) or (n_targets, n_features)
824824 Parameter vector (w in the problem formulation).
825825
826826 n_nonzero_coefs_ : int
@@ -874,11 +874,11 @@ def fit(self, X, y):
874874
875875 Parameters
876876 ----------
877- X : array-like, shape [ n_samples, n_features]
877+ X : array-like of shape ( n_samples, n_features)
878878 Training data.
879879
880- y : array-like, shape [ n_samples]
881- Target values. Will be cast to X's dtype if necessary
880+ y : array-like of shape ( n_samples,)
881+ Target values. Will be cast to X's dtype if necessary.
882882
883883 Returns
884884 -------
0 commit comments