@@ -184,6 +184,12 @@ def _estimator_type(self):
184
184
185
185
@property
186
186
def classes_ (self ):
187
+ """Classes labels available when `estimator` is a classifier.
188
+
189
+ Returns
190
+ -------
191
+ ndarray of shape (n_classes,)
192
+ """
187
193
return self .estimator_ .classes_
188
194
189
195
def fit (self , X , y ):
@@ -196,6 +202,11 @@ def fit(self, X, y):
196
202
197
203
y : array-like of shape (n_samples,)
198
204
The target values.
205
+
206
+ Returns
207
+ -------
208
+ self : object
209
+ Fitted estimator.
199
210
"""
200
211
return self ._fit (X , y )
201
212
@@ -407,8 +418,7 @@ def _more_tags(self):
407
418
408
419
409
420
class RFECV (RFE ):
410
- """Feature ranking with recursive feature elimination and cross-validated
411
- selection of the best number of features.
421
+ """Recursive feature elimination with cross-validation to select the number of features.
412
422
413
423
See glossary entry for :term:`cross-validation estimator`.
414
424
@@ -457,7 +467,7 @@ class RFECV(RFE):
457
467
.. versionchanged:: 0.22
458
468
``cv`` default value of None changed from 3-fold to 5-fold.
459
469
460
- scoring : string , callable or None, default=None
470
+ scoring : str , callable or None, default=None
461
471
A string (see model evaluation documentation) or
462
472
a scorer callable object / function with signature
463
473
``scorer(estimator, X, y)``.
@@ -522,6 +532,10 @@ class RFECV(RFE):
522
532
support_ : ndarray of shape (n_features,)
523
533
The mask of selected features.
524
534
535
+ See Also
536
+ --------
537
+ RFE : Recursive feature elimination.
538
+
525
539
Notes
526
540
-----
527
541
The size of ``grid_scores_`` is equal to
@@ -530,6 +544,13 @@ class RFECV(RFE):
530
544
531
545
Allows NaN/Inf in the input if the underlying estimator does as well.
532
546
547
+ References
548
+ ----------
549
+
550
+ .. [1] Guyon, I., Weston, J., Barnhill, S., & Vapnik, V., "Gene selection
551
+ for cancer classification using support vector machines",
552
+ Mach. Learn., 46(1-3), 389--422, 2002.
553
+
533
554
Examples
534
555
--------
535
556
The following example shows how to retrieve the a-priori not known 5
@@ -547,17 +568,6 @@ class RFECV(RFE):
547
568
False])
548
569
>>> selector.ranking_
549
570
array([1, 1, 1, 1, 1, 6, 4, 3, 2, 5])
550
-
551
- See Also
552
- --------
553
- RFE : Recursive feature elimination.
554
-
555
- References
556
- ----------
557
-
558
- .. [1] Guyon, I., Weston, J., Barnhill, S., & Vapnik, V., "Gene selection
559
- for cancer classification using support vector machines",
560
- Mach. Learn., 46(1-3), 389--422, 2002.
561
571
"""
562
572
563
573
def __init__ (
@@ -600,6 +610,11 @@ def fit(self, X, y, groups=None):
600
610
instance (e.g., :class:`~sklearn.model_selection.GroupKFold`).
601
611
602
612
.. versionadded:: 0.20
613
+
614
+ Returns
615
+ -------
616
+ self : object
617
+ Fitted estimator.
603
618
"""
604
619
tags = self ._get_tags ()
605
620
X , y = self ._validate_data (
0 commit comments