SLP

This module implements the algorithm SLP.

References

[1]D.-M. Liang and Y.-F. Li. Lightweight Label Propagation for Large-Scale Network Data. In: 27th International Joint Conference on Artificial Intelligence (IJCAI‘18), Stockholm, Sweden, 2018.
Author:
De-Ming Liang <XXX@gmail.com> Xiao-Shuang Lv <XXX@XXX.com>
License:
MIT
class s3l.data_quality.SLP.SLP(stepSize=0.1, T=6)[source]

Bases: s3l.base.TransductiveEstimatorwithGraph

This is a python implementation of SLP, which can do label propagation on large-scale graphs.

Read more in the User Guide.

Parameters:
  • stepSize (coefficient, optical (default=0.1)) – step size.
  • T (coefficient,optical (default=6)) – running epoches.

Examples

>>> from s3l.data_quality.SLP import SLP
>>> from s3l.datasets import data_manipulate, base
>>> X, y = base.load_covtype(True)
>>> W = base.load_graph_covtype(True)
>>> _, test_idxs, labeled_idxs, unlabeled_idxs = \
>>>                       data_manipulate.inductive_split(X=X, y=y)
>>> slp = SLP(stepSize=0.1, T=6)
>>> slp.fit(X,y,labeled_idxs,W)
>>> slp.predict(unlabeled_idxs)
[1,-1,-1,1,1...,1]

References

SLP implements the LEAD algorithm in [1].

[1]D.-M. Liang and Y.-F. Li. Lightweight Label Propagation for Large-Scale Network Data. In: 27th International Joint Conference on Artificial Intelligence (IJCAI‘18), Stockholm, Sweden, 2018.
fit(X, y, l_ind, W)[source]

Fit the model to data.

Parameters:
  • W (sparse matrix) – affinity matrix, labels should be at the left-top corner, should be in sparse form.
  • y (array-like) – label vector with different labels [n_samples].
  • l_ind (array-like) – a row vector with length l, where l is the number of labeled instance. Each element is an index of a labeled instance.
Returns:

pred – prediction of labels [n_samples, n_labels], in the original sort.

Return type:

array-like

predict(u_ind)[source]

Compute the most possible label for samples in W.

Parameters:u_ind (array-like) – a row vector with length l, where l is the number of unlabeled instance. Each element is an index of a unlabeled instance.
Returns:pred – Each row is the most likely label for a sample [n_samples].
Return type:array-like
predict_proba(u_ind)[source]

Compute probabilities of possible labels for samples in W.

Parameters:u_ind (array-like) – a row vector with length l, where l is the number of unlabeled instance. Each element is an index of a unlabeled instance.
Returns:pred – Each line is the probability of possible labels of a sample involved in the calculation of the prediction [n_samples, n_labels].
Return type:array-like
set_params(param)[source]

Parameter setting function.

Parameters::dict (param) – Store parameter names and corresponding values {‘name’: value}.