Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

LaplacianSVMSSLR

General Interface for LaplacianSVM model


Description

model from RSSL package Manifold regularization applied to the support vector machine as proposed in Belkin et al. (2006). As an adjacency matrix, we use the k nearest neighbour graph based on a chosen distance (default: euclidean).

Usage

LaplacianSVMSSLR(
  lambda = 1,
  gamma = 1,
  scale = TRUE,
  kernel = kernlab::vanilladot(),
  adjacency_distance = "euclidean",
  adjacency_k = 6,
  normalized_laplacian = FALSE,
  eps = 1e-09
)

Arguments

lambda

numeric; L2 regularization parameter

gamma

numeric; Weight of the unlabeled data

scale

logical; Should the features be normalized? (default: FALSE)

kernel

kernlab::kernel to use

adjacency_distance

character; distance metric used to construct adjacency graph from the dist function. Default: "euclidean"

adjacency_k

integer; Number of of neighbours used to construct adjacency graph.

normalized_laplacian

logical; If TRUE use the normalized Laplacian, otherwise, the Laplacian is used

eps

numeric; Small value to ensure positive definiteness of the matrix in the QP formulation

References

Belkin, M., Niyogi, P. & Sindhwani, V., 2006. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of Machine Learning Research, 7, pp.2399-2434.

Examples

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 <- LaplacianSVMSSLR(kernel=kernlab::vanilladot()) %>%
  fit(Class ~ ., data = train)

#Accuracy
predict(m,test) %>%
  bind_cols(test) %>%
  metrics(truth = "Class", estimate = .pred_class)

SSLR

Semi-Supervised Classification, Regression and Clustering Methods

v0.9.3.1
GPL-3
Authors
Francisco Jesús Palomares Alabarce [aut, cre] (<https://orcid.org/0000-0002-0499-7034>), José Manuel Benítez [ctb] (<https://orcid.org/0000-0002-2346-0793>), Isaac Triguero [ctb] (<https://orcid.org/0000-0002-0150-0651>), Christoph Bergmeir [ctb] (<https://orcid.org/0000-0002-3665-9021>), Mabel González [ctb] (<https://orcid.org/0000-0003-0152-444X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.