diff --git a/sklearn/semi_supervised/_label_propagation.py b/sklearn/semi_supervised/_label_propagation.py index 45324715224d0..d7463268c1c97 100644 --- a/sklearn/semi_supervised/_label_propagation.py +++ b/sklearn/semi_supervised/_label_propagation.py @@ -184,6 +184,10 @@ def predict(self, X): y : ndarray of shape (n_samples,) Predictions for input data. """ + # Note: since `predict` does not accept semi-supervised labels as input, + # `fit(X, y).predict(X) != fit(X, y).transduction_`. + # Hence, `fit_predict` is not implemented. + # See https://github.com/scikit-learn/scikit-learn/pull/24898 probas = self.predict_proba(X) return self.classes_[np.argmax(probas, axis=1)].ravel() @@ -244,7 +248,7 @@ def fit(self, X, y): y : array-like of shape (n_samples,) Target class values with unlabeled points marked as -1. All unlabeled samples will be transductively assigned labels - internally. + internally, which are stored in `transduction_`. Returns ------- @@ -371,7 +375,7 @@ class LabelPropagation(BaseLabelPropagation): Categorical distribution for each item. transduction_ : ndarray of shape (n_samples) - Label assigned to each item via the transduction. + Label assigned to each item during :term:`fit`. n_features_in_ : int Number of features seen during :term:`fit`. @@ -466,7 +470,7 @@ def fit(self, X, y): y : array-like of shape (n_samples,) Target class values with unlabeled points marked as -1. All unlabeled samples will be transductively assigned labels - internally. + internally, which are stored in `transduction_`. Returns ------- @@ -531,7 +535,7 @@ class LabelSpreading(BaseLabelPropagation): Categorical distribution for each item. transduction_ : ndarray of shape (n_samples,) - Label assigned to each item via the transduction. + Label assigned to each item during :term:`fit`. n_features_in_ : int Number of features seen during :term:`fit`.