SSLR provides a collection of techniques for semi-supervised classification and regression. In semi-supervised problems, both labeled and unlabeled data are used to train a model. The package includes a collection of semi-supervised learning techniques: self-training, co-training, democratic, decision tree, random forest, S3VM … etc, with a fairly intuitive interface that is easy to use.

This package uses RSSL package for build models with S3VMs.

This package has been designed and implemented to solve semi-supervised learning problems. Using data that is not labeled can improve the accuracy of the predictions.

With few lines of code we will be able to give different solutions with a simple and intuitive interface.

Installation

# Install release version from CRAN
install.packages("SSLR")

Usage (some models)

library(tidyverse)
library(tidymodels) #Load a lot of packages like parsnip
library(caret) #For creating data
library(SSLR)

data(wine)

set.seed(1)
train.index <- createDataPartition(wine$Wine, p = .7, list = FALSE)
train <- wine[ train.index,]
test  <- wine[-train.index,]

cls <- which(colnames(wine) == "Wine")

#5 % LABELED DATA
labeled.index <- createDataPartition(wine$Wine, p = .05, list = FALSE)
train[-labeled.index,cls] <- NA

#With decision tree from rpart package
dt <-  decision_tree(mode = "classification", tree_depth = 10) %>%
  set_engine("rpart")

#Models using dt
m <- SSLRDecisionTree(w = 0.3) %>% fit(Wine ~ ., data = train)

m <- selfTraining(learner = dt) %>% fit(Wine ~ ., data = train)

m <- coBC(learner = dt,N = 10,perc.full = 0.6) %>% fit(Wine ~ ., data = train)

m <- triTraining(learner = dt) %>% fit(Wine ~ ., data = train)

m <- setred(learner = dt) %>% fit(Wine ~ ., data = train)