@@ -37,30 +37,30 @@ class SelfTrainingClassifier(MetaEstimatorMixin, BaseEstimator):
37
37
Parameters
38
38
----------
39
39
base_estimator : estimator object
40
- An estimator object implementing `` fit`` and `` predict_proba` `.
41
- Invoking the `` fit` ` method will fit a clone of the passed estimator,
42
- which will be stored in the `` base_estimator_` ` attribute.
40
+ An estimator object implementing `fit` and `predict_proba`.
41
+ Invoking the `fit` method will fit a clone of the passed estimator,
42
+ which will be stored in the `base_estimator_` attribute.
43
43
44
44
threshold : float, default=0.75
45
45
The decision threshold for use with `criterion='threshold'`.
46
- Should be in [0, 1). When using the 'threshold' criterion, a
46
+ Should be in [0, 1). When using the ` 'threshold'` criterion, a
47
47
:ref:`well calibrated classifier <calibration>` should be used.
48
48
49
49
criterion : {'threshold', 'k_best'}, default='threshold'
50
50
The selection criterion used to select which labels to add to the
51
- training set. If 'threshold', pseudo-labels with prediction
52
- probabilities above `threshold` are added to the dataset. If 'k_best',
51
+ training set. If ` 'threshold'` , pseudo-labels with prediction
52
+ probabilities above `threshold` are added to the dataset. If ` 'k_best'` ,
53
53
the `k_best` pseudo-labels with highest prediction probabilities are
54
54
added to the dataset. When using the 'threshold' criterion, a
55
55
:ref:`well calibrated classifier <calibration>` should be used.
56
56
57
57
k_best : int, default=10
58
58
The amount of samples to add in each iteration. Only used when
59
- `criterion` is k_best'.
59
+ `criterion=' k_best'` .
60
60
61
61
max_iter : int or None, default=10
62
62
Maximum number of iterations allowed. Should be greater than or equal
63
- to 0. If it is `` None` `, the classifier will continue to predict labels
63
+ to 0. If it is `None`, the classifier will continue to predict labels
64
64
until no new pseudo-labels are added, or all unlabeled samples have
65
65
been labeled.
66
66
@@ -74,7 +74,7 @@ class SelfTrainingClassifier(MetaEstimatorMixin, BaseEstimator):
74
74
75
75
classes_ : ndarray or list of ndarray of shape (n_classes,)
76
76
Class labels for each output. (Taken from the trained
77
- `` base_estimator_` `).
77
+ `base_estimator_`).
78
78
79
79
transduction_ : ndarray of shape (n_samples,)
80
80
The labels used for the final fit of the classifier, including
@@ -104,11 +104,24 @@ class SelfTrainingClassifier(MetaEstimatorMixin, BaseEstimator):
104
104
termination_condition_ : {'max_iter', 'no_change', 'all_labeled'}
105
105
The reason that fitting was stopped.
106
106
107
- - 'max_iter': `n_iter_` reached `max_iter`.
108
- - 'no_change': no new labels were predicted.
109
- - 'all_labeled': all unlabeled samples were labeled before `max_iter`
107
+ - ` 'max_iter'` : `n_iter_` reached `max_iter`.
108
+ - ` 'no_change'` : no new labels were predicted.
109
+ - ` 'all_labeled'` : all unlabeled samples were labeled before `max_iter`
110
110
was reached.
111
111
112
+ See Also
113
+ --------
114
+ LabelPropagation : Label propagation classifier.
115
+ LabelSpreading : Label spreading model for semi-supervised learning.
116
+
117
+ References
118
+ ----------
119
+ David Yarowsky. 1995. Unsupervised word sense disambiguation rivaling
120
+ supervised methods. In Proceedings of the 33rd annual meeting on
121
+ Association for Computational Linguistics (ACL '95). Association for
122
+ Computational Linguistics, Stroudsburg, PA, USA, 189-196. DOI:
123
+ https://doi.org/10.3115/981658.981684
124
+
112
125
Examples
113
126
--------
114
127
>>> import numpy as np
@@ -123,14 +136,6 @@ class SelfTrainingClassifier(MetaEstimatorMixin, BaseEstimator):
123
136
>>> self_training_model = SelfTrainingClassifier(svc)
124
137
>>> self_training_model.fit(iris.data, iris.target)
125
138
SelfTrainingClassifier(...)
126
-
127
- References
128
- ----------
129
- David Yarowsky. 1995. Unsupervised word sense disambiguation rivaling
130
- supervised methods. In Proceedings of the 33rd annual meeting on
131
- Association for Computational Linguistics (ACL '95). Association for
132
- Computational Linguistics, Stroudsburg, PA, USA, 189-196. DOI:
133
- https://doi.org/10.3115/981658.981684
134
139
"""
135
140
136
141
_estimator_type = "classifier"
@@ -153,7 +158,7 @@ def __init__(
153
158
154
159
def fit (self , X , y ):
155
160
"""
156
- Fits this ``SelfTrainingClassifier`` to a dataset .
161
+ Fit self-training classifier using `X`, `y` as training data .
157
162
158
163
Parameters
159
164
----------
@@ -167,7 +172,7 @@ def fit(self, X, y):
167
172
Returns
168
173
-------
169
174
self : object
170
- Returns an instance of self .
175
+ Fitted estimator .
171
176
"""
172
177
# we need row slicing support for sparce matrices, but costly finiteness check
173
178
# can be delegated to the base estimator.
@@ -281,7 +286,7 @@ def fit(self, X, y):
281
286
282
287
@if_delegate_has_method (delegate = "base_estimator" )
283
288
def predict (self , X ):
284
- """Predict the classes of X .
289
+ """Predict the classes of `X` .
285
290
286
291
Parameters
287
292
----------
@@ -326,7 +331,7 @@ def predict_proba(self, X):
326
331
327
332
@if_delegate_has_method (delegate = "base_estimator" )
328
333
def decision_function (self , X ):
329
- """Calls decision function of the `base_estimator`.
334
+ """Call decision function of the `base_estimator`.
330
335
331
336
Parameters
332
337
----------
@@ -372,7 +377,7 @@ def predict_log_proba(self, X):
372
377
373
378
@if_delegate_has_method (delegate = "base_estimator" )
374
379
def score (self , X , y ):
375
- """Calls score on the `base_estimator`.
380
+ """Call score on the `base_estimator`.
376
381
377
382
Parameters
378
383
----------
0 commit comments