Description Usage Arguments References Examples
model from RSSL package Transductive SVM using the CCCP algorithm as proposed by Collobert et al. (2006) implemented in R using the quadprog package. The implementation does not handle large datasets very well, but can be useful for smaller datasets and visualization purposes. C is the cost associated with labeled objects, while Cstar is the cost for the unlabeled objects. s control the loss function used for the unlabeled objects: it controls the size of the plateau for the symmetric ramp loss function. The balancing constraint makes sure the label assignments of the unlabeled objects are similar to the prior on the classes that was observed on the labeled data.
1 2 3 4 5 6 7 8 9 10 11 12 |
C |
numeric; Cost parameter of the SVM |
Cstar |
numeric; Cost parameter of the unlabeled objects |
kernel |
kernlab::kernel to use |
balancing_constraint |
logical; Whether a balancing constraint should be enfored that causes the fraction of objects assigned to each label in the unlabeled data to be similar to the label fraction in the labeled data. |
s |
numeric; parameter controlling the loss function of the unlabeled objects (generally values between -1 and 0) |
x_center |
logical; Should the features be centered? |
scale |
If TRUE, apply a z-transform to all observations in X and X_u before running the regression |
eps |
numeric; Stopping criterion for the maximinimization |
max_iter |
integer; Maximum number of iterations |
verbose |
logical; print debugging messages, only works for vanilladot() kernel (default: FALSE) |
Collobert, R. et al., 2006. Large scale transductive SVMs. Journal of Machine Learning Research, 7, pp.1687-1712.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | library(tidyverse)
library(caret)
library(tidymodels)
library(SSLR)
data(breast)
set.seed(1)
train.index <- createDataPartition(breast$Class, p = .7, list = FALSE)
train <- breast[ train.index,]
test <- breast[-train.index,]
cls <- which(colnames(breast) == "Class")
#% LABELED
labeled.index <- createDataPartition(breast$Class, p = .2, list = FALSE)
train[-labeled.index,cls] <- NA
library(kernlab)
m <- TSVMSSLR(kernel = kernlab::vanilladot()) %>% fit(Class ~ ., data = train)
#Accesing model from RSSL
model <- m$model
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.