sslLabelProp: Label Propagation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/SSL.R

Description

sslLabelProp propagates a few known labels to a large number of unknown labels according to their proximities to neighboring nodes. It supports many kinds of distance measurements and graph representations.

Usage

1
2
sslLabelProp(x, y, known.label, graph.type = "exp", dist.type = "Euclidean",
  alpha, alpha1, alpha2, k, epsilon, iter = 1000)

Arguments

x

a n * p matrix or data.frame of n observations and p predictors

y

a vector of k known labels. The rows of y must be the same as the length of known.label.

known.label

a vector indicating the row index of known labels in matrix x.

graph.type

character string; which type of graph should be created? Options include knn,enn,tanh and exp.

  • knn :kNN graphs.Nodes i, j are connected by an edge if i is in j 's k-nearest-neighborhood. k is a hyperparameter that controls the density of the graph.

  • enn :epsilon-NN graphs. Nodes i, j are connected by an edge, if the distance d(i, j ) < epsilon. The hyperparameter epsilon controls neighborhood radius.

  • tanh:tanh-weighted graphs. w(i,j) = (tanh(alpha1(d(i,j) - alpha2)) + 1)/2. where d(i,j) denotes the distance between point i and j. Hyperparameters alpha1 and alpha2 control the slope and cutoff value respectively.

  • exp :exp-weighted graphs.w(i,j) = exp(-d(i,j)^2/alpha^2),where d(i,j) denotes the distance between point i and j. Hyperparameter alpha controls the decay rate.

dist.type

character string; this parameter controls the type of distance measurement.(see dist or pr_DB).

alpha

numeric parameter needed when graph.type = exp

alpha1

numeric parameter needed when graph.type = tanh

alpha2

numeric parameter needed when graph.type = tanh

k

integer parameter needed when graph.type = knn

epsilon

numeric parameter needed when graph.type = enn

iter

iteration

Details

sslLabelProp implements label propagation algorithm in iter iterations.It supports many kinds of distance measurements and four types of graph creations.

Value

a n * 1 vector indicating the predictions of n observations in C class

Author(s)

Junxiang Wang

References

Xiaojin Zhu(2005),Semi-Supervised Learning with Graphs

See Also

dist, pr_DB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(iris)
x<-iris[,1:4]
#Suppose we know the first twenty observations of each class and we want to propagate
#these labels to unlabeled data.
# 1 setosa, 2 versicolor, 3 virginica
y<-rep(1:3,each =20)
known.label <-c(1:20,51:70,101:120)
f1<-sslLabelProp(x,y,known.label,graph.type="enn",epsilon = 0.5)
f2<-sslLabelProp(x,y,known.label,graph.type="knn",k =10)
f3<-sslLabelProp(x,y,known.label,graph.type="tanh",alpha1=-2,alpha2=1)
f4<-sslLabelProp(x,y,known.label,graph.type="exp",alpha = 1)

Example output



SSL documentation built on May 29, 2017, 7:14 p.m.

Related to sslLabelProp in SSL...