# NOT RUN {
# Provide an example of predicting the new labels with label propagation
# Load views into list "dataL" and the cluster assignment into vector "label"
data(dataL)
data(label)
# Create the training and test data
n = floor(0.8*length(label)) # number of training cases
trainSample = sample.int(length(label), n)
train = lapply(dataL, function(x) x[trainSample, ]) # Use the first 150 samples for training
test = lapply(dataL, function(x) x[-trainSample, ]) # Test the rest of the data set
groups = label[trainSample]
# Set the other
K = 20
alpha = 0.5
t = 20
method = TRUE
# Apply the prediction function to the data
newLabel = groupPredict(train,test,groups,K,alpha,t,method)
# Compare the prediction accuracy
accuracy = sum(label[-trainSample] == newLabel[-c(1:n)])/(length(label) - n)
# }
Run the code above in your browser using DataLab