hdsvm is an R package for high-dimensional support vector machines. It is especially useful for classification problems where the number of features is much larger than the number of samples, such as in gene expression datasets.
This README shows basic usage examples based on the official vignette.
This package provides tools for fitting the penalized SVM.
The strengths and improvements that this package offers relative to other SVM packages are as follows:
-
Compiled Fortran code significantly speeds up the penalized SVM estimation process.
-
Solve the elastic net penalized SVM using generalized coordinate descent algorithm.
-
Active-set and warm-start strategies implemented to compute the solution path as
$\lambda_1$ varies.
Then the penalized SVM model is formulated as:
where the ∘ symbol represents the Hadamard (element-wise) product.
install.packages("hdsvm")library(hdsvm)
set.seed(315)
n <- 100
p <- 400
x1 <- matrix(rnorm(n / 2 * p, -0.25, 0.1), n / 2)
x2 <- matrix(rnorm(n / 2 * p, 0.25, 0.1), n / 2)
x <- rbind(x1, x2)
beta <- 0.1 * rnorm(p)
prob <- plogis(c(x %*% beta))
y <- 2 * rbinom(n, 1, prob) - 1