# NOT RUN {
set.seed(1)
df <- generate2ClassGaussian(2000,d=2,var=0.6)
classifiers <- list("LS"=function(X,y,X_u,y_u) {
LeastSquaresClassifier(X,y,lambda=0)},
"Self"=function(X,y,X_u,y_u) {
SelfLearning(X,y,X_u,LeastSquaresClassifier)}
)
measures <- list("Accuracy" = measure_accuracy,
"Loss Test" = measure_losstest,
"Loss labeled" = measure_losslab,
"Loss Lab+Unlab" = measure_losstrain
)
# These take a couple of seconds to run
# }
# NOT RUN {
# Increase the number of unlabeled objects
lc1 <- LearningCurveSSL(as.matrix(df[,1:2]),df$Class,
classifiers=classifiers,
measures=measures, n_test=1800,
n_l=10,repeats=3)
plot(lc1)
# Increase the fraction of labeled objects, example with 2 datasets
lc2 <- LearningCurveSSL(X=list("Dataset 1"=as.matrix(df[,1:2]),
"Dataset 2"=as.matrix(df[,1:2])),
y=list("Dataset 1"=df$Class,
"Dataset 2"=df$Class),
classifiers=classifiers,
measures=measures,
type = "fraction",repeats=3,
test_fraction=0.9)
plot(lc2)
# }
Run the code above in your browser using DataLab