gensvm.refit {gensvm}R Documentation

Train an already fitted model on new data

Description

This function can be used to train an existing model on new data or fit an existing model with slightly different parameters. It is useful for retraining without having to copy all the parameters over. One common application for this is to refit the best model found by a grid search, as illustrated in the examples.

Usage

gensvm.refit(
  fit,
  x,
  y,
  p = NULL,
  lambda = NULL,
  kappa = NULL,
  epsilon = NULL,
  weights = NULL,
  kernel = NULL,
  gamma = NULL,
  coef = NULL,
  degree = NULL,
  kernel.eigen.cutoff = NULL,
  max.iter = NULL,
  verbose = NULL,
  random.seed = NULL
)

Arguments

fit

Fitted gensvm object

x

Data matrix of the new data

y

Label vector of the new data

p

if NULL use the value from fit in the new model, otherwise override with this value.

lambda

if NULL use the value from fit in the new model, otherwise override with this value.

kappa

if NULL use the value from fit in the new model, otherwise override with this value.

epsilon

if NULL use the value from fit in the new model, otherwise override with this value.

weights

if NULL use the value from fit in the new model, otherwise override with this value.

kernel

if NULL use the value from fit in the new model, otherwise override with this value.

gamma

if NULL use the value from fit in the new model, otherwise override with this value.

coef

if NULL use the value from fit in the new model, otherwise override with this value.

degree

if NULL use the value from fit in the new model, otherwise override with this value.

kernel.eigen.cutoff

if NULL use the value from fit in the new model, otherwise override with this value.

max.iter

if NULL use the value from fit in the new model, otherwise override with this value.

verbose

if NULL use the value from fit in the new model, otherwise override with this value.

random.seed

if NULL use the value from fit in the new model, otherwise override with this value.

Value

a new fitted gensvm model

Author(s)

Gerrit J.J. van den Burg, Patrick J.F. Groenen
Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com>

References

Van den Burg, G.J.J. and Groenen, P.J.F. (2016). GenSVM: A Generalized Multiclass Support Vector Machine, Journal of Machine Learning Research, 17(225):1–42. URL https://jmlr.org/papers/v17/14-526.html.

See Also

gensvm, gensvm-package

Examples

x <- iris[, -5]
y <- iris[, 5]

# fit a standard model and refit with slightly different parameters
fit <- gensvm(x, y)
fit2 <- gensvm.refit(fit, x, y, epsilon=1e-8)


# refit a model returned by a grid search
grid <- gensvm.grid(x, y)
fit <- gensvm.refit(fit, x, y, epsilon=1e-8)


# refit on different data
idx <- runif(nrow(x)) > 0.5
x1 <- x[idx, ]
x2 <- x[!idx, ]
y1 <- y[idx]
y2 <- y[!idx]

fit1 <- gensvm(x1, y1)
fit2 <- gensvm.refit(fit1, x2, y2)


[Package gensvm version 0.1.7 Index]