@@ -447,6 +447,20 @@ def orthogonal_mp(
447
447
return np .squeeze (coef )
448
448
449
449
450
+ @validate_params (
451
+ {
452
+ "Gram" : ["array-like" ],
453
+ "Xy" : ["array-like" ],
454
+ "n_nonzero_coefs" : [Interval (Integral , 0 , None , closed = "neither" ), None ],
455
+ "tol" : [Interval (Real , 0 , None , closed = "left" ), None ],
456
+ "norms_squared" : ["array-like" , None ],
457
+ "copy_Gram" : ["boolean" ],
458
+ "copy_Xy" : ["boolean" ],
459
+ "return_path" : ["boolean" ],
460
+ "return_n_iter" : ["boolean" ],
461
+ },
462
+ prefer_skip_nested_validation = True ,
463
+ )
450
464
def orthogonal_mp_gram (
451
465
Gram ,
452
466
Xy ,
@@ -468,30 +482,30 @@ def orthogonal_mp_gram(
468
482
469
483
Parameters
470
484
----------
471
- Gram : ndarray of shape (n_features, n_features)
472
- Gram matrix of the input data: X.T * X.
485
+ Gram : array-like of shape (n_features, n_features)
486
+ Gram matrix of the input data: ` X.T * X` .
473
487
474
- Xy : ndarray of shape (n_features,) or (n_features, n_targets)
475
- Input targets multiplied by X: X.T * y.
488
+ Xy : array-like of shape (n_features,) or (n_features, n_targets)
489
+ Input targets multiplied by `X`: ` X.T * y` .
476
490
477
491
n_nonzero_coefs : int, default=None
478
- Desired number of non-zero entries in the solution. If None (by
492
+ Desired number of non-zero entries in the solution. If ` None` (by
479
493
default) this value is set to 10% of n_features.
480
494
481
495
tol : float, default=None
482
- Maximum norm of the residual. If not None, overrides n_nonzero_coefs.
496
+ Maximum norm of the residual. If not ` None` , overrides ` n_nonzero_coefs` .
483
497
484
498
norms_squared : array-like of shape (n_targets,), default=None
485
- Squared L2 norms of the lines of y . Required if tol is not None.
499
+ Squared L2 norms of the lines of `y` . Required if ` tol` is not None.
486
500
487
501
copy_Gram : bool, default=True
488
- Whether the gram matrix must be copied by the algorithm. A false
502
+ Whether the gram matrix must be copied by the algorithm. A `False`
489
503
value is only helpful if it is already Fortran-ordered, otherwise a
490
504
copy is made anyway.
491
505
492
506
copy_Xy : bool, default=True
493
- Whether the covariance vector Xy must be copied by the algorithm.
494
- If False, it may be overwritten.
507
+ Whether the covariance vector `Xy` must be copied by the algorithm.
508
+ If ` False` , it may be overwritten.
495
509
496
510
return_path : bool, default=False
497
511
Whether to return every value of the nonzero coefficients along the
@@ -505,11 +519,11 @@ def orthogonal_mp_gram(
505
519
coef : ndarray of shape (n_features,) or (n_features, n_targets)
506
520
Coefficients of the OMP solution. If `return_path=True`, this contains
507
521
the whole coefficient path. In this case its shape is
508
- (n_features, n_features) or (n_features, n_targets, n_features) and
522
+ ` (n_features, n_features)` or ` (n_features, n_targets, n_features)` and
509
523
iterating over the last axis yields coefficients in increasing order
510
524
of active features.
511
525
512
- n_iters : array-like or int
526
+ n_iters : list or int
513
527
Number of active features across every target. Returned only if
514
528
`return_n_iter` is set to True.
515
529
0 commit comments