Learn R Programming

⚠️There's a newer version (0.2.9.3) of this package.Take me there.

SVMMaj R package

Introduction

The main features of this package are: implementation of the SVM-Maj majorization algorithm for SVMs, handling of nonlinearity through splines and kernels, the ability to handle several error functions (among other the classic hinge, quadratic hinge and Huber hinge error).

How to use this package

The main functions of the package are svmmaj, which estimates the SVM, and svmmajcrossval, which performs a grid search of k-fold cross validations using SVM-Maj to find the combination of input values, (such as lambda and degree in the case of a polynomial kernel) giving the best prediction performance.

The former function requires the n x k attribute matrix X and the n x 1 vector y with class labels. Apart from the data objects, other parameter input values can be given as input to tune the model:

  • lambda,
  • hinge,
  • weights.obs,
  • scale, and
  • parameters for nonlinearities and settings of the algorithm itself.

For example,

svmmaj(X, y, lambda = 2, hinge = "quadratic", scale = "interval")

runs the SVM model with lambda = 2, using a quadratic hinge and for each attribute, the values are scaled to the interval [0,1]. The function svmmajcrossval uses the same parameter input values and additionally the parameters to be used as grid points of the k-fold cross validation. These parameters should be given in the list object search.grid, e.g.,

svmmajcrossval(X, y, search.grid = list(lambda = c(1, 2, 4)))

Copy Link

Version

Install

install.packages('SVMMaj')

Monthly Downloads

210

Version

0.2.9.1

License

GPL-2

Maintainer

Hok San Yip

Last Published

May 23rd, 2022

Functions in SVMMaj (0.2.9.1)

plot.hinge

Plot the hinge function
voting

Congressional Voting Records Data Set
print.svmmajcrossval

Print SVMMaj cross validation results
transformdata

Transform the data with normalization and/or spline basis
print.svmmaj

Print Svmmaj class
predict.svmmaj

Out-of-Sample Prediction from Unseen Data.
predict.transDat

Perform the transformation based on predefined settings
svmmajcrossval

k-fold Cross-Validation of SVM-Maj
print.q.svmmaj

SVM-Maj Algorithm
roccurve

Plot the ROC curve of the predicted values
supermarket1996

Supermarket data 1996
plotWeights

Plot the weights of all attributes from the trained SVM model
plot.svmmajcrossval

Plot the cross validation output
X.svmmaj

Returns transformed attributes
isplinebasis

Transform a given data into I-splines
classification

Show the classification performance
auc

Returns the area under the curve value
isb

I-spline basis of each column of a given matrix
normalize

Normalize/standardize the columns of a matrix
AusCredit

Australian Credit Approval Dataset
diabetes

Pima Indians Diabetes Data Set
getHinge

Hinge error function of SVM-Maj