Skip to content

Commit 07ceb6e

Browse files
ankishbglemaitre
authored andcommitted
DOC follow doc guideline in ensemble an feature_extraction modules (scikit-learn#15975)
1 parent e5c54ca commit 07ceb6e

File tree

12 files changed

+420
-415
lines changed

12 files changed

+420
-415
lines changed

sklearn/ensemble/_bagging.py

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ def _fit(self, X, y, max_samples=None, max_depth=None, sample_weight=None):
259259
The target values (class labels in classification, real numbers in
260260
regression).
261261
262-
max_samples : int or float, optional (default=None)
262+
max_samples : int or float, default=None
263263
Argument to use instead of self.max_samples.
264264
265-
max_depth : int, optional (default=None)
265+
max_depth : int, default=None
266266
Override value used when constructing base estimator. Only
267267
supported if the base estimator has a max_depth parameter.
268268
@@ -456,57 +456,57 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
456456
457457
Parameters
458458
----------
459-
base_estimator : object or None, optional (default=None)
459+
base_estimator : object, default=None
460460
The base estimator to fit on random subsets of the dataset.
461461
If None, then the base estimator is a decision tree.
462462
463-
n_estimators : int, optional (default=10)
463+
n_estimators : int, default=10
464464
The number of base estimators in the ensemble.
465465
466-
max_samples : int or float, optional (default=1.0)
466+
max_samples : int or float, default=1.0
467467
The number of samples to draw from X to train each base estimator.
468468
469469
- If int, then draw `max_samples` samples.
470470
- If float, then draw `max_samples * X.shape[0]` samples.
471471
472-
max_features : int or float, optional (default=1.0)
472+
max_features : int or float, default=1.0
473473
The number of features to draw from X to train each base estimator.
474474
475475
- If int, then draw `max_features` features.
476476
- If float, then draw `max_features * X.shape[1]` features.
477477
478-
bootstrap : boolean, optional (default=True)
478+
bootstrap : bool, default=True
479479
Whether samples are drawn with replacement. If False, sampling
480480
without replacement is performed.
481481
482-
bootstrap_features : boolean, optional (default=False)
482+
bootstrap_features : bool, default=False
483483
Whether features are drawn with replacement.
484484
485-
oob_score : bool, optional (default=False)
485+
oob_score : bool, default=False
486486
Whether to use out-of-bag samples to estimate
487487
the generalization error.
488488
489-
warm_start : bool, optional (default=False)
489+
warm_start : bool, default=False
490490
When set to True, reuse the solution of the previous call to fit
491491
and add more estimators to the ensemble, otherwise, just fit
492492
a whole new ensemble. See :term:`the Glossary <warm_start>`.
493493
494494
.. versionadded:: 0.17
495495
*warm_start* constructor parameter.
496496
497-
n_jobs : int or None, optional (default=None)
497+
n_jobs : int, default=None
498498
The number of jobs to run in parallel for both :meth:`fit` and
499499
:meth:`predict`. ``None`` means 1 unless in a
500500
:obj:`joblib.parallel_backend` context. ``-1`` means using all
501501
processors. See :term:`Glossary <n_jobs>` for more details.
502502
503-
random_state : int, RandomState instance or None, optional (default=None)
503+
random_state : int, RandomState instance, default=None
504504
If int, random_state is the seed used by the random number generator;
505505
If RandomState instance, random_state is the random number generator;
506506
If None, the random number generator is the RandomState instance used
507507
by `np.random`.
508508
509-
verbose : int, optional (default=0)
509+
verbose : int, default=0
510510
Controls the verbosity when fitting and predicting.
511511
512512
Attributes
@@ -527,7 +527,7 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
527527
estimators_features_ : list of arrays
528528
The subset of drawn features for each base estimator.
529529
530-
classes_ : array of shape (n_classes,)
530+
classes_ : ndarray of shape (n_classes,)
531531
The classes labels.
532532
533533
n_classes_ : int or list
@@ -537,7 +537,7 @@ class BaggingClassifier(ClassifierMixin, BaseBagging):
537537
Score of the training dataset obtained using an out-of-bag estimate.
538538
This attribute exists only when ``oob_score`` is True.
539539
540-
oob_decision_function_ : array of shape (n_samples, n_classes)
540+
oob_decision_function_ : ndarray of shape (n_samples, n_classes)
541541
Decision function computed with out-of-bag estimate on the training
542542
set. If n_estimators is small it might be possible that a data point
543543
was never left out during the bootstrap. In this case,
@@ -689,7 +689,7 @@ def predict_proba(self, X):
689689
690690
Returns
691691
-------
692-
p : array of shape (n_samples, n_classes)
692+
p : ndarray of shape (n_samples, n_classes)
693693
The class probabilities of the input samples. The order of the
694694
classes corresponds to that in the attribute :term:`classes_`.
695695
"""
@@ -739,7 +739,7 @@ def predict_log_proba(self, X):
739739
740740
Returns
741741
-------
742-
p : array of shape (n_samples, n_classes)
742+
p : ndarray of shape (n_samples, n_classes)
743743
The class log-probabilities of the input samples. The order of the
744744
classes corresponds to that in the attribute :term:`classes_`.
745745
"""
@@ -794,7 +794,7 @@ def decision_function(self, X):
794794
795795
Returns
796796
-------
797-
score : array, shape = [n_samples, k]
797+
score : ndarray of shape (n_samples, k)
798798
The decision function of the input samples. The columns correspond
799799
to the classes in sorted order, as they appear in the attribute
800800
``classes_``. Regression and binary classification are special
@@ -858,54 +858,54 @@ class BaggingRegressor(RegressorMixin, BaseBagging):
858858
859859
Parameters
860860
----------
861-
base_estimator : object or None, optional (default=None)
861+
base_estimator : object, default=None
862862
The base estimator to fit on random subsets of the dataset.
863863
If None, then the base estimator is a decision tree.
864864
865-
n_estimators : int, optional (default=10)
865+
n_estimators : int, default=10
866866
The number of base estimators in the ensemble.
867867
868-
max_samples : int or float, optional (default=1.0)
868+
max_samples : int or float, default=1.0
869869
The number of samples to draw from X to train each base estimator.
870870
871871
- If int, then draw `max_samples` samples.
872872
- If float, then draw `max_samples * X.shape[0]` samples.
873873
874-
max_features : int or float, optional (default=1.0)
874+
max_features : int or float, default=1.0
875875
The number of features to draw from X to train each base estimator.
876876
877877
- If int, then draw `max_features` features.
878878
- If float, then draw `max_features * X.shape[1]` features.
879879
880-
bootstrap : boolean, optional (default=True)
880+
bootstrap : bool, default=True
881881
Whether samples are drawn with replacement. If False, sampling
882882
without replacement is performed.
883883
884-
bootstrap_features : boolean, optional (default=False)
884+
bootstrap_features : bool, default=False
885885
Whether features are drawn with replacement.
886886
887-
oob_score : bool
887+
oob_score : bool, default=False
888888
Whether to use out-of-bag samples to estimate
889889
the generalization error.
890890
891-
warm_start : bool, optional (default=False)
891+
warm_start : bool, default=False
892892
When set to True, reuse the solution of the previous call to fit
893893
and add more estimators to the ensemble, otherwise, just fit
894894
a whole new ensemble. See :term:`the Glossary <warm_start>`.
895895
896-
n_jobs : int or None, optional (default=None)
896+
n_jobs : int, default=None
897897
The number of jobs to run in parallel for both :meth:`fit` and
898898
:meth:`predict`. ``None`` means 1 unless in a
899899
:obj:`joblib.parallel_backend` context. ``-1`` means using all
900900
processors. See :term:`Glossary <n_jobs>` for more details.
901901
902-
random_state : int, RandomState instance or None, optional (default=None)
902+
random_state : int, RandomState instance, default=None
903903
If int, random_state is the seed used by the random number generator;
904904
If RandomState instance, random_state is the random number generator;
905905
If None, the random number generator is the RandomState instance used
906906
by `np.random`.
907907
908-
verbose : int, optional (default=0)
908+
verbose : int, default=0
909909
Controls the verbosity when fitting and predicting.
910910
911911
Attributes

sklearn/ensemble/_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def _set_random_states(estimator, random_state=None):
4949
Estimator with potential randomness managed by random_state
5050
parameters.
5151
52-
random_state : int, RandomState instance or None, optional (default=None)
52+
random_state : int, RandomState instance, default=None
5353
If int, random_state is the seed used by the random number generator;
5454
If RandomState instance, random_state is the random number generator;
5555
If None, the random number generator is the RandomState instance used
@@ -83,13 +83,13 @@ class BaseEnsemble(MetaEstimatorMixin, BaseEstimator, metaclass=ABCMeta):
8383
8484
Parameters
8585
----------
86-
base_estimator : object, optional (default=None)
86+
base_estimator : object, default=None
8787
The base estimator from which the ensemble is built.
8888
89-
n_estimators : integer
89+
n_estimators : int
9090
The number of estimators in the ensemble.
9191
92-
estimator_params : list of strings
92+
estimator_params : list of str
9393
The list of attributes to use as parameters when instantiating a
9494
new base estimator. If none are given, default parameters are used.
9595
@@ -276,7 +276,7 @@ def get_params(self, deep=True):
276276
277277
Parameters
278278
----------
279-
deep : bool
279+
deep : bool, default=True
280280
Setting it to True gets the various classifiers and the parameters
281281
of the classifiers as well.
282282
"""

0 commit comments

Comments
 (0)