This R package provides implementations of several semi-supervised learning methods, in particular, our own work involving constraint based semi-supervised learning.
The package is still under development. Therefore, function names and interfaces are subject to change.
This package is not yet available on CRAN. To install the latest version of the package using the devtools package:
library(devtools)
install_github("jkrijthe/RSSL")
After installation, load the package as usual:
library(RSSL)
The following code generates a simple dataset, trains a supervised and two semi-supervised classifiers and evaluates their performance:
# Generate dataset
df <- generate2ClassGaussian(d=2,expected=TRUE)
df_lab <- df[sample(nrow(df),10),]
df_unlab <- df[sample(nrow(df),1000),]
df_unlab$Class <- NA
df_combined <- rbind(df_lab, df_unlab)
# Train Classifiers
t_sup <- LeastSquaresClassifier(Class~., df_lab)
t_self <- SelfLearning(Class~., df_combined, method=LeastSquaresClassifier)
t_ic <- ICLeastSquaresClassifier(Class~., df_combined)
# Evaluate performance: Squared Loss & Error Rate
mean(loss(t_sup,df))
mean(loss(t_self,df))
mean(loss(t_ic,df))
mean(predict(t_sup,df)!=df$Class)
mean(predict(t_self,df)!=df$Class)
mean(predict(t_ic,df)!=df$Class)
For an overview of different classifiers and examples on how to use them, see the classifier overview vignette.
Work on this package was supported by Project 23 of the Dutch national program COMMIT.