The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

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:

For this getting-started vignette, first, we will randomly generate x, an input matrix of predictors of dimension \(n\times p\) and a response variable 'y'.

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

Then the penalized SVM model is formulated as:

$$ \min{\beta\in\mathbb{R}{p},b_0\in\mathbb{R}} \frac{1}{n} \sum{i=1}{n}[\max{1 - y_i (\beta_0 + x_i\top \beta), 0}]

hdsvm()

Given an input matrix x and a response vector y, the elastic net penalized SVM model is estimated for a sequence of penalty parameter values. The other main arguments the users might supply are:

lambda <- 10^(seq(1, -4, length.out=30))
lam2 <- 0.01
fit <- hdsvm(x, y, lambda=lambda, lam2=lam2)

cv.hdsvm()

This function performs k-fold cross-validation (cv) for the hdsvm() model. It takes the same arguments x, y, lambda, which are specified above, with additional argument nfolds and foldid for the error measure.

cv.fit <- cv.hdsvm(x, y, lambda=lambda)

nc.hdsvm()

This function fits the penalized SVM model using nonconvex penalties such as SCAD or MCP. It allows for flexible control over the regularization parameters and offers advanced options for initializing and optimizing the fit. It takes the same arguments x, y,lambda, lam2, which are specified above.The other main arguments the users might supply are:

nc.fit <- nc.hdsvm(x=x, y=y, lambda=lambda, lam2=lam2, pen="scad")

cv.nc.hdsvm()

This function onducts k-fold cross-validation for the nc.hdsvm() function. It takes the same arguments as the cv.hdsvm() function.

cv.nc.fit <- cv.nc.hdsvm(y=y, x=x, lambda=lambda, lam2=lam2, pen="scad")

Methods

A number of S3 methods are provided for hdsvm, cv.hdsvm, nc.hdsvm and cv.nc.hdsvm objects.

coefs <- coef(fit, s = fit$lambda[3:5])
preds <- predict(fit, newx = tail(x), s = fit$lambda[3:5])
cv.coefs <- coef(cv.fit, s = c(0.02, 0.03))
cv.preds <- predict(cv.fit, newx = x[50:60, ], s = "lambda.min")
nc.coefs <- coef(nc.fit, s = nc.fit$lambda[3:5])
nc.preds <- predict(nc.fit, newx = tail(x), s = fit$lambda[3:5])
cv.nc.coefs <- coef(cv.nc.fit, s = c(0.02, 0.03))
cv.nc.preds <- predict(cv.nc.fit, newx = x[50:60, ], s = "lambda.min")

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.