Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11f9e82

Browse files
scottgigante-immunaijjerphan
authored andcommitted
DOC Improve docs of BaseLabelPropagation.transduction_ (scikit-learn#24985)
1 parent 556a159 commit 11f9e82

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

sklearn/semi_supervised/_label_propagation.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ def predict(self, X):
184184
y : ndarray of shape (n_samples,)
185185
Predictions for input data.
186186
"""
187+
# Note: since `predict` does not accept semi-supervised labels as input,
188+
# `fit(X, y).predict(X) != fit(X, y).transduction_`.
189+
# Hence, `fit_predict` is not implemented.
190+
# See https://github.com/scikit-learn/scikit-learn/pull/24898
187191
probas = self.predict_proba(X)
188192
return self.classes_[np.argmax(probas, axis=1)].ravel()
189193

@@ -244,7 +248,7 @@ def fit(self, X, y):
244248
y : array-like of shape (n_samples,)
245249
Target class values with unlabeled points marked as -1.
246250
All unlabeled samples will be transductively assigned labels
247-
internally.
251+
internally, which are stored in `transduction_`.
248252
249253
Returns
250254
-------
@@ -371,7 +375,7 @@ class LabelPropagation(BaseLabelPropagation):
371375
Categorical distribution for each item.
372376
373377
transduction_ : ndarray of shape (n_samples)
374-
Label assigned to each item via the transduction.
378+
Label assigned to each item during :term:`fit`.
375379
376380
n_features_in_ : int
377381
Number of features seen during :term:`fit`.
@@ -466,7 +470,7 @@ def fit(self, X, y):
466470
y : array-like of shape (n_samples,)
467471
Target class values with unlabeled points marked as -1.
468472
All unlabeled samples will be transductively assigned labels
469-
internally.
473+
internally, which are stored in `transduction_`.
470474
471475
Returns
472476
-------
@@ -531,7 +535,7 @@ class LabelSpreading(BaseLabelPropagation):
531535
Categorical distribution for each item.
532536
533537
transduction_ : ndarray of shape (n_samples,)
534-
Label assigned to each item via the transduction.
538+
Label assigned to each item during :term:`fit`.
535539
536540
n_features_in_ : int
537541
Number of features seen during :term:`fit`.

0 commit comments

Comments
 (0)