1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gensvm.refit.R
\name{gensvm.refit}
\alias{gensvm.refit}
\title{Train an already fitted model on new data}
\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{
\item{fit}{Fitted \code{gensvm} object}
\item{x}{Data matrix of the new data}
\item{y}{Label vector of the new data}
\item{p}{if NULL use the value from \code{fit} in the new model, otherwise
override with this value.}
\item{lambda}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{kappa}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{epsilon}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{weights}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{kernel}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{gamma}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{coef}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{degree}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{kernel.eigen.cutoff}{if NULL use the value from \code{fit} in the new
model, otherwise override with this value.}
\item{max.iter}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{verbose}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
\item{random.seed}{if NULL use the value from \code{fit} in the new model,
otherwise override with this value.}
}
\value{
a new fitted \code{gensvm} model
}
\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.
}
\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)
\donttest{
# 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)
}
\references{
Van den Burg, G.J.J. and Groenen, P.J.F. (2016). \emph{GenSVM: A Generalized
Multiclass Support Vector Machine}, Journal of Machine Learning Research,
17(225):1--42. URL \url{http://jmlr.org/papers/v17/14-526.html}.
}
\seealso{
\code{\link{gensvm}}, \code{\link{gensvm-package}}
}
\author{
Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr
Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com>
}
|