# LabelPropagation¶

class ibex.sklearn.semi_supervised.LabelPropagation(kernel='rbf', gamma=20, n_neighbors=7, alpha=None, max_iter=1000, tol=0.001, n_jobs=1)

Bases: sklearn.semi_supervised.label_propagation.LabelPropagation, ibex._base.FrameMixin

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

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
alpha : float

Clamping factor.

Deprecated since version 0.19: This parameter will be removed in 0.21. ‘alpha’ is fixed to zero in ‘LabelPropagation’.

max_iter : integer
Change maximum number of iterations allowed
tol : float
Convergence tolerance: threshold to consider the system at steady state
n_jobs : int, optional (default = 1)
The number of parallel jobs to run. If -1, then the number of jobs is set to the number of CPU cores.
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.
>>> from sklearn import datasets
>>> from sklearn.semi_supervised import LabelPropagation
>>> label_prop_model = LabelPropagation()
>>> 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(...)


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

LabelSpreading : Alternate label propagation strategy more robust to noise

fit(X, y)[source]

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

predict(X)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Performs inductive inference across the model.

X : array_like, shape = [n_samples, n_features]

y : array_like, shape = [n_samples]
Predictions for input data
predict_proba(X)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Predict probability for each possible outcome.

Compute the probability estimates for each single sample in X and each possible outcome seen during training (categorical distribution).

X : array_like, shape = [n_samples, n_features]

probabilities : array, shape = [n_samples, n_classes]
Normalized probability distributions across class labels
score(X, y, sample_weight=None)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Returns the mean accuracy on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

X : array-like, shape = (n_samples, n_features)
Test samples.
y : array-like, shape = (n_samples) or (n_samples, n_outputs)
True labels for X.
sample_weight : array-like, shape = [n_samples], optional
Sample weights.
score : float
Mean accuracy of self.predict(X) wrt. y.