svmmajcrossval: k-fold Cross-Validation of SVM-Maj

View source: R/svmmajcrossval.R

svmmajcrossvalR Documentation

k-fold Cross-Validation of SVM-Maj

Description

This function performs a gridsearch of k-fold cross-validations using SVM-Maj and returns the combination of input values which has the best forecasting performance.

Usage

svmmajcrossval(
  X,
  y,
  search.grid = list(lambda = 2^seq(5, -5, length.out = 19)),
  ...,
  convergence = 1e-04,
  weights.obs = 1,
  check.positive = TRUE,
  mc.cores = getOption("mc.cores"),
  options = NULL,
  verbose = FALSE,
  ngroup = 5,
  groups = NULL,
  return.model = FALSE
)

Arguments

X

A data frame (or object coercible by as.data.frame to a data frame) consisting the attributes.

y

A factor (or object coercible by factor to a factor) consisting the class labels.

search.grid

A list with for each factor the range of values to search for.

...

Other arguments to be passed through svmmaj.

convergence

Specifies the convergence criterion for svmmaj. Default is 1e-08.

weights.obs

Weights for the classes.

check.positive

Specifies whether a check should be performed for positive lambda and weights.obs.

mc.cores

the number of cores to be used (for parallel computing)

options

additional settings used in the svmmaj algorithm

verbose

=TRUE shows the progress of the cross-validation.

ngroup

The number of groups to be divided into.

groups

A predetermined group division for performing the cross validation.

return.model

=TRUE estimates the model with the optimal parameters.

Value

loss.opt

The minimum (weighted) missclassification rate found in out-of-sample training along the search grid.

param.opt

The level of the factors which gives the minimum loss term value.

loss.grp

A list of missclassification rates per hold-out sample

groups

A vector defining the cross-validation groups which has been used.

qhat

The estimated out-of-sample predicted values in the cross-validation.

qhat.in

The trained predicted values

param.grid

The matrix of all gridpoints which has been performed during the cross-validation, with its corresponding weighted out-of-sample missclassification rate.

model

The svmmaj-object with the estimated model using the optimal parameters found in the cross-validation.

Author(s)

Hok San Yip, Patrick J.F. Groenen, Georgi Nalbantov

References

P.J.F. Groenen, G. Nalbantov and J.C. Bioch (2008) SVM-Maj: a majorization approach to linear support vector machines with different hinge errors.

See Also

svmmaj

Examples


Xt <- diabetes$X
yt <- diabetes$y

## performing gridsearch with k-fold cross-validation
results <- svmmajcrossval(
   Xt, yt, 
  scale = 'interval',
  mc.cores = 2,
  ngroup = 5,
  return.model = TRUE
)

summary(results$model)
results
plot(results)
plot(results, 'profile')

SVMMaj documentation built on Sept. 11, 2024, 6:06 p.m.