README.md

dbvsmsvm

Derivative-based variable selection method for the angle-based multicategory support vector machine

dbvsmsvm is an R package. dbvsmsvm provides functions to perform the derivative-based variable selection method for multicategory problems using the reinforced angle-based multicategory support vector machine (RAMSVM). It also provides functions performing the structured reinforced angle-based MSVM (SRAMSVM) and generating simulated data.

1. INSTALLATION

dbvsmsvm is not submitted to CRAN. Therefore, dbvsmsvm can not be installed through install.packages("dbvsmsvm") in R prompt. Instead, dbvsmsvm can be installed through our GitHub. Please see below to install in R.

(1) From GitHub

> library(devtools)
> install_github("bbeomjin/dbvsmsvm")

2. USAGE NOTES

(1) Description of R functions in dbvsmsvm

(2) List of R functions in dbvsmsvm package

3. EXAMPLE

# Generation of simulated data with linear decision boundary
> require(dbvsmsvm)
> n = 100; p = 10; 
> data = dbvsmsvm:::sim_gen(n = n, p = p, type = "linear")
> x = scale(data$x)
> y = data$y
> sigma = kernlab::sigest(y ~ x, scaled = FALSE)[3]


# Fit the DBVS-MSVM method with the linear and Gaussian kernel
# The number of lambda values is set to 100. 
# The number of threshold values is set to 100.
# The optimal lambda and threshold values are selected via 5-fold cross-validation with one standard error rule.
# Fit the DBVS-MSVM with the linear kernel
> dbvs_linear = dbvsmsvm(x = x, y = y, nfolds = 5, lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                         Nofv = 100, kernel = "linear", scale = FALSE, cv_type = "osr", 
                         interaction = FALSE, gamma = 0.5, optModel = FALSE, nCores = 1)
# Fitted values
> fitted = predict(dbvs_linear)
# Fitted classes
> fitted$class

# Predicted values for new data
> pred = predict(dbvs_linear, newx = x)
# Predicted classes
> pred$class

# Fit the DBVS-MSVM method with the Gaussian kernel
> dbvs_radial = dbvsmsvm(x = x, y = y, nfolds = 5, lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                         Nofv = 100, kernel = "gaussian", kparam = sigma, scale = FALSE, cv_type = "osr", 
                         interaction = FALSE, gamma = 0.5, optModel = TRUE, nCores = 1)
# Fitted values
> fitted = predict(dbvs_radial)
# Fitted classes
> fitted$class

# Predicted values for new data
> pred = predict(dbvs_radial, newx = x)
# Predicted classes
> pred$class

# Fit the DBVS-MSVM with the Gaussian kernel for selecting second-order interaction
> dbvs_interaction = dbvsmsvm(x = x, y = y, nfolds = 5, lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                             Nofv = 100, kernel = "gaussian", kparam = sigma, criterion = "0-1", scale = FALSE,
                             cv_type = "osr", interaction = TRUE, gamma = 0.5, optModel = TRUE, nCores = 1)


# Fit the SRAMSVM with the linear kernel
> sram_linear = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
                        lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                        lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
                        kernel = "linear", scale = FALSE, criterion = "0-1",
                        isCombined = TRUE, cv_type = "osr", optModel = FALSE, nCores = 1)
# Fitted values
> fitted = predict(sram_linear)
# Fitted classes
> fitted$class

# Predicted values for new data
> pred = predict(sram_linear, newx = x)
# Predicted classes
> pred$class


# Fit the SRAMSVM with the Gaussian kernel
> sram_radial = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
                        lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                        lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
                        kernel = "gaussian", kparam = sigma, scale = FALSE, criterion = "0-1",
                        isCombined = TRUE, cv_type = "osr", optModel = TRUEnCores = 1)
# Fitted values
> fitted = predict(sram_radial)
# Fitted classes
> fitted$class

# Predicted values for new data
> pred = predict(sram_radial, newx = x)
# Predicted classes
> pred$class

# Fit the SRAMSVM with the Gaussian kernel with second-order interaction
> sram_radial_interaction = sramsvm(x = x, y = y, gamma = 0.5, nfolds = 5,
                                   lambda_seq = 2^{seq(-20, 0, length.out = 100)},
                                   lambda_theta_seq = 2^{seq(-20, 0, length.out = 100)},
                                   kernel = "gaussian", kparam = sigma, scale = FALSE, criterion = "0-1",
                                   isCombined = TRUE, cv_type = "osr", nCores = 1)



bbeomjin/GBFSMSVM documentation built on Nov. 7, 2021, 10:20 p.m.