mars.learn.semi_supervised.
LabelPropagation
Label Propagation classifier
Read more in the User Guide.
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
X_
Input array.
array, shape = [n_samples, n_features]
classes_
The distinct labels used in classifying instances.
array, shape = [n_classes]
label_distributions_
Categorical distribution for each item.
array, shape = [n_samples, n_classes]
transduction_
Label assigned to each item via the transduction.
array, shape = [n_samples]
n_iter_
Number of iterations run.
int
Examples
>>> import numpy as np >>> from sklearn import datasets >>> from mars.learn.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) >>> labels[random_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
__init__
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__([kernel, gamma, n_neighbors, …])
Initialize self.
fit(X, y[, session, run_kwargs])
fit
Fit a semi-supervised label propagation model based
get_params([deep])
get_params
Get parameters for this estimator.
predict(X[, session, run_kwargs])
predict
Performs inductive inference across the model.
predict_proba(X[, session, run_kwargs])
predict_proba
Predict probability for each possible outcome.
score(X, y[, sample_weight, session, run_kwargs])
score
Return the mean accuracy on the given test data and labels.
set_params(**params)
set_params
Set the parameters of this estimator.