Label Propagation classifier
Read more in the :ref:`User Guide <label_propagation>`.
Parameters ---------- kernel : 'knn', 'rbf', callable
String identifier for kernel function to use or the kernel function itself. Only 'rbf' and 'knn' strings are valid inputs. The function passed should take two inputs, each of shape n_samples, n_features
, and return a n_samples, n_samples
shaped weight matrix.
gamma : float Parameter for rbf kernel
n_neighbors : integer > 0 Parameter for knn kernel
max_iter : integer Change maximum number of iterations allowed
tol : float Convergence tolerance: threshold to consider the system at steady state
n_jobs : int or None, optional (default=None) The number of parallel jobs to run. ``None`` means 1 unless in a :obj:`joblib.parallel_backend` context. ``-1`` means using all processors. See :term:`Glossary <n_jobs>` for more details.
Attributes ---------- X_ : array, shape = n_samples, n_features
Input array.
classes_ : array, shape = n_classes
The distinct labels used in classifying instances.
label_distributions_ : array, shape = n_samples, n_classes
Categorical distribution for each item.
transduction_ : array, shape = n_samples
Label assigned to each item via the transduction.
n_iter_ : int Number of iterations run.
Examples -------- >>> import numpy as np >>> from sklearn import datasets >>> from sklearn.semi_supervised import LabelPropagation >>> label_prop_model = LabelPropagation() >>> iris = datasets.load_iris() >>> rng = np.random.RandomState(42) >>> random_unlabeled_points = rng.rand(len(iris.target)) < 0.3 >>> labels = np.copy(iris.target) >>> labelsrandom_unlabeled_points
= -1 >>> label_prop_model.fit(iris.data, labels) LabelPropagation(...)
References ---------- Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. Technical Report CMU-CALD-02-107, Carnegie Mellon University, 2002 http://pages.cs.wisc.edu/~jerryzhu/pub/CMU-CALD-02-107.pdf
See Also -------- LabelSpreading : Alternate label propagation strategy more robust to noise