diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-04 15:08:12 -0400 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-04 15:08:12 -0400 |
| commit | 459ce96fa8a0072d3533bc2dc1566cc1b797401b (patch) | |
| tree | 229a5d9b137f7fcf3b5112e4a189e972d6dafa26 | |
| parent | Ensure classes isn't a factor (diff) | |
| download | rgensvm-459ce96fa8a0072d3533bc2dc1566cc1b797401b.tar.gz rgensvm-459ce96fa8a0072d3533bc2dc1566cc1b797401b.zip | |
Documentation improvements
| -rw-r--r-- | R/gensvm.R | 5 | ||||
| -rw-r--r-- | R/gensvm.accuracy.R | 5 | ||||
| -rw-r--r-- | R/gensvm.grid.R | 29 | ||||
| -rw-r--r-- | R/gensvm.refit.R | 44 | ||||
| -rw-r--r-- | R/gensvm.train.test.split.R | 6 | ||||
| -rw-r--r-- | R/plot.gensvm.R | 14 | ||||
| -rw-r--r-- | R/validate.R | 14 | ||||
| -rw-r--r-- | man/coef.gensvm.Rd | 4 | ||||
| -rw-r--r-- | man/fitted.gensvm.Rd | 5 | ||||
| -rw-r--r-- | man/fitted.gensvm.grid.Rd | 5 | ||||
| -rw-r--r-- | man/gensvm.Rd | 6 | ||||
| -rw-r--r-- | man/gensvm.accuracy.Rd | 7 | ||||
| -rw-r--r-- | man/gensvm.generate.cv.idx.Rd | 21 | ||||
| -rw-r--r-- | man/gensvm.rank.score.Rd | 11 | ||||
| -rw-r--r-- | man/gensvm.refit.Rd | 51 | ||||
| -rw-r--r-- | man/gensvm.train.test.split.Rd | 8 | ||||
| -rw-r--r-- | man/gensvm.validate.param.grid.Rd | 8 | ||||
| -rw-r--r-- | man/gensvm.validate.params.Rd | 8 | ||||
| -rw-r--r-- | man/plot.gensvm.Rd | 27 | ||||
| -rw-r--r-- | man/plot.gensvm.grid.Rd | 4 | ||||
| -rw-r--r-- | man/predict.gensvm.Rd | 4 | ||||
| -rw-r--r-- | man/predict.gensvm.grid.Rd | 8 | ||||
| -rw-r--r-- | man/print.gensvm.Rd | 4 | ||||
| -rw-r--r-- | man/print.gensvm.grid.Rd | 4 |
24 files changed, 243 insertions, 59 deletions
@@ -13,6 +13,9 @@ #' @param lambda regularization parameter for the loss function (lambda > 0) #' @param kappa parameter for the hinge function in the loss function (kappa > #' -1.0) +#' @param epsilon Stopping parameter for the optimization algorithm. The +#' optimization will stop if the relative change in the loss function is below +#' this value. #' @param weights type or vector of instance weights to use. Options are 'unit' #' for unit weights and 'group' for group size correction weights (eq. 4 in the #' paper). Alternatively, a vector of weights can be provided. @@ -92,7 +95,7 @@ #' fit <- gensvm(x, y) #' #' # fit and show progress -#' fit <- gensvm(x, y, verbose=T) +#' fit <- gensvm(x, y, verbose=TRUE) #' #' # fit with some changed parameters #' fit <- gensvm(x, y, lambda=1e-8) diff --git a/R/gensvm.accuracy.R b/R/gensvm.accuracy.R index c762dd7..387c2db 100644 --- a/R/gensvm.accuracy.R +++ b/R/gensvm.accuracy.R @@ -1,8 +1,13 @@ #' @title Compute the accuracy score #' +#' @description Compute the accuracy score between the true labels and the +#' predicted labels. +#' #' @param y.true vector of true labels #' @param y.pred vector of predicted labels #' +#' @return The accuracy as a value in the range [0.0, 1.0] +#' #' @author #' Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr #' Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com> diff --git a/R/gensvm.grid.R b/R/gensvm.grid.R index 7be065b..755d650 100644 --- a/R/gensvm.grid.R +++ b/R/gensvm.grid.R @@ -362,11 +362,29 @@ gensvm.load.small.grid <- function() } -#' Generate a vector of cross-validation indices +#' @title Generate a vector of cross-validation indices #' +#' @description #' This function generates a vector of length \code{n} with values from 0 to #' \code{folds-1} to mark train and test splits. #' +#' @param n the number of instances +#' @param folds the number of cross validation folds +#' +#' @return an array of length \code{n} with values in the range [0, folds-1] +#' indicating the test fold of each instance. +#' +#' @author +#' Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr +#' Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com> +#' +#' @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.grid}} gensvm.generate.cv.idx <- function(n, folds) { cv.idx <- matrix(0, n, 1) @@ -572,13 +590,14 @@ gensvm.expand.param.grid <- function(pg, n.features) #' @title Compute the ranks for the numbers in a given vector #' -#' @details -#' This function computes the ranks for the values in an array. The highest -#' value gets the smallest rank. Ties are broken by assigning the smallest -#' value. +#' @description This function computes the ranks for the values in an array. +#' The highest value gets the smallest rank. Ties are broken by assigning the +#' smallest value. The smallest rank is 1. #' #' @param x array of numeric values #' +#' @return array with the ranks of the values in the input array. +#' gensvm.rank.score <- function(x) { x <- as.array(x) diff --git a/R/gensvm.refit.R b/R/gensvm.refit.R index b7a1a15..f3b818b 100644 --- a/R/gensvm.refit.R +++ b/R/gensvm.refit.R @@ -1,16 +1,40 @@ #' @title Train an already fitted model on new data #' -#' @title 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. +#' @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. #' #' @param fit Fitted \code{gensvm} object -#' @param X Data matrix of the new data +#' @param x Data matrix of the new data #' @param y Label vector of the new data -#' @param verbose Turn on verbose output and fit progress. If NULL (the -#' default) the value from the fitted model is chosen. +#' @param p if NULL use the value from \code{fit} in the new model, otherwise +#' override with this value. +#' @param lambda if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param kappa if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param epsilon if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param weights if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param kernel if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param gamma if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param coef if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param degree if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param kernel.eigen.cutoff if NULL use the value from \code{fit} in the new +#' model, otherwise override with this value. +#' @param max.iter if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param verbose if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. +#' @param random.seed if NULL use the value from \code{fit} in the new model, +#' otherwise override with this value. #' #' @return a new fitted \code{gensvm} model #' @@ -50,7 +74,7 @@ #' fit1 <- gensvm(x1, y1) #' fit2 <- gensvm.refit(fit1, x2, y2) #' -gensvm.refit <- function(fit, X, y, p=NULL, lambda=NULL, kappa=NULL, +gensvm.refit <- function(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) @@ -76,7 +100,7 @@ gensvm.refit <- function(fit, X, y, p=NULL, lambda=NULL, kappa=NULL, # after the call to gensvm(). errfunc <- getOption('error') options(error=function() {}) - newfit <- gensvm(X, y, p=p, lambda=lambda, kappa=kappa, epsilon=epsilon, + newfit <- gensvm(x, y, p=p, lambda=lambda, kappa=kappa, epsilon=epsilon, weights=weights, kernel=kernel, gamma=gamma, coef=coef, degree=degree, kernel.eigen.cutoff=kernel.eigen.cutoff, verbose=verbose, max.iter=max.iter, seed.V=coef(fit)) diff --git a/R/gensvm.train.test.split.R b/R/gensvm.train.test.split.R index eca4b06..cd40ecc 100644 --- a/R/gensvm.train.test.split.R +++ b/R/gensvm.train.test.split.R @@ -18,6 +18,12 @@ #' of 0.25 will be used. #' @param shuffle shuffle the rows or not #' @param random.state seed for the random number generator (int) +#' @param return.idx whether or not to return the indices in the output +#' +#' @return a list with \code{x.train} and \code{x.test} splits of the \code{x} +#' array provided. If \code{y} is provided, also \code{y.train} and +#' \code{y.test}. If \code{return.idx} is TRUE, also \code{idx.train} and +#' \code{idx.test}. #' #' @author #' Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr diff --git a/R/plot.gensvm.R b/R/plot.gensvm.R index 129d90a..3f6f5d2 100644 --- a/R/plot.gensvm.R +++ b/R/plot.gensvm.R @@ -1,8 +1,8 @@ #' @title Plot the simplex space of the fitted GenSVM model #' #' @description This function creates a plot of the simplex space for a fitted -#' GenSVM model and the given data set, as long as the dataset consists of only -#' 3 classes. For more than 3 classes, the simplex space is too high +#' GenSVM model and the given data set. This function works for dataset with +#' two or three classes. For more than 3 classes, the simplex space is too high #' dimensional to easily visualize. #' #' @param x A fitted \code{gensvm} object @@ -60,8 +60,14 @@ #' # plot only misclassified samples #' x.mis <- x[predict(fit) != y, ] #' y.mis.true <- y[predict(fit) != y] -#' plot(fit, x.test=x.mis) -#' plot(fit, y.mis.true, x.test=x.mis) +#' plot(fit, newdata=x.mis) +#' plot(fit, y.mis.true, newdata=x.mis) +#' +#' # plot a 2-d model +#' xx <- x[y %in% c('versicolor', 'virginica'), ] +#' yy <- y[y %in% c('versicolor', 'virginica')] +#' fit <- gensvm(xx, yy, kernel='rbf', max.iter=5000) +#' plot(fit) #' plot.gensvm <- function(x, labels, newdata=NULL, with.margins=TRUE, with.shading=TRUE, with.legend=TRUE, center.plot=TRUE, diff --git a/R/validate.R b/R/validate.R index 5960a38..c708158 100644 --- a/R/validate.R +++ b/R/validate.R @@ -1,7 +1,14 @@ #' @title [internal] Validate parameters #' +#' @description Internal function used to validate the parameters passed to the +#' gensvm() function. +#' +#' @return TRUE if all values pass their respective conditions, FALSE +#' otherwise. +#' #' @export #' @keywords internal +#' gensvm.validate.params <- function(p=NULL, kappa=NULL, lambda=NULL, epsilon=NULL, gamma=NULL, weights=NULL, kernel=NULL, ...) @@ -26,8 +33,15 @@ gensvm.validate.params <- function(p=NULL, kappa=NULL, lambda=NULL, #' @title [internal] Validate parameter grid #' +#' @description Internal function to validate all parameters in a parameter +#' grid. +#' +#' @return TRUE if all values pass their respective conditions, FALSE +#' otherwise. +#' #' @export #' @keywords internal +#' gensvm.validate.param.grid <- function(df) { expected.colnames <- c("kernel", "coef", "degree", "gamma", "weights", diff --git a/man/coef.gensvm.Rd b/man/coef.gensvm.Rd index 9f08ecc..aba3efe 100644 --- a/man/coef.gensvm.Rd +++ b/man/coef.gensvm.Rd @@ -4,10 +4,10 @@ \alias{coef.gensvm} \title{Get the coefficients of the fitted GenSVM model} \usage{ -\method{coef}{gensvm}(fit, ...) +\method{coef}{gensvm}(object, ...) } \arguments{ -\item{fit}{a \code{gensvm} object} +\item{object}{a \code{gensvm} object} \item{\dots}{further arguments are ignored} } diff --git a/man/fitted.gensvm.Rd b/man/fitted.gensvm.Rd index b242eb8..c65123e 100644 --- a/man/fitted.gensvm.Rd +++ b/man/fitted.gensvm.Rd @@ -2,13 +2,12 @@ % Please edit documentation in R/fitted.gensvm.R \name{fitted.gensvm} \alias{fitted.gensvm} -\alias{fitted} \title{Show fitted labels for the GenSVM model} \usage{ -\method{fitted}{gensvm}(fit, ...) +\method{fitted}{gensvm}(object, ...) } \arguments{ -\item{fit}{Fitted \code{gensvm} object} +\item{object}{Fitted \code{gensvm} object} \item{\dots}{further arguments are passed to predict} } diff --git a/man/fitted.gensvm.grid.Rd b/man/fitted.gensvm.grid.Rd index 1e2f697..455df7e 100644 --- a/man/fitted.gensvm.grid.Rd +++ b/man/fitted.gensvm.grid.Rd @@ -2,13 +2,12 @@ % Please edit documentation in R/fitted.gensvm.grid.R \name{fitted.gensvm.grid} \alias{fitted.gensvm.grid} -\alias{fitted} \title{Fitted labels for the GenSVMGrid class} \usage{ -\method{fitted}{gensvm.grid}(grid, ...) +\method{fitted}{gensvm.grid}(object, ...) } \arguments{ -\item{grid}{A \code{gensvm.grid} object} +\item{object}{A \code{gensvm.grid} object} \item{\dots}{further arguments are passed to fitted} } diff --git a/man/gensvm.Rd b/man/gensvm.Rd index b6c9bf0..4f5d614 100644 --- a/man/gensvm.Rd +++ b/man/gensvm.Rd @@ -24,6 +24,10 @@ function (i.e. \code{model.matrix( ~ var - 1)}).} \item{kappa}{parameter for the hinge function in the loss function (kappa > -1.0)} +\item{epsilon}{Stopping parameter for the optimization algorithm. The +optimization will stop if the relative change in the loss function is below +this value.} + \item{weights}{type or vector of instance weights to use. Options are 'unit' for unit weights and 'group' for group size correction weights (eq. 4 in the paper). Alternatively, a vector of weights can be provided.} @@ -99,7 +103,7 @@ y <- iris[, 5] fit <- gensvm(x, y) # fit and show progress -fit <- gensvm(x, y, verbose=T) +fit <- gensvm(x, y, verbose=TRUE) # fit with some changed parameters fit <- gensvm(x, y, lambda=1e-8) diff --git a/man/gensvm.accuracy.Rd b/man/gensvm.accuracy.Rd index 9463fa5..25b8fb7 100644 --- a/man/gensvm.accuracy.Rd +++ b/man/gensvm.accuracy.Rd @@ -11,6 +11,13 @@ gensvm.accuracy(y.true, y.pred) \item{y.pred}{vector of predicted labels} } +\value{ +The accuracy as a value in the range [0.0, 1.0] +} +\description{ +Compute the accuracy score between the true labels and the +predicted labels. +} \examples{ x <- iris[, -5] y <- iris[, 5] diff --git a/man/gensvm.generate.cv.idx.Rd b/man/gensvm.generate.cv.idx.Rd index 38d8829..dbba19e 100644 --- a/man/gensvm.generate.cv.idx.Rd +++ b/man/gensvm.generate.cv.idx.Rd @@ -6,7 +6,28 @@ \usage{ gensvm.generate.cv.idx(n, folds) } +\arguments{ +\item{n}{the number of instances} + +\item{folds}{the number of cross validation folds} +} +\value{ +an array of length \code{n} with values in the range [0, folds-1] +indicating the test fold of each instance. +} \description{ This function generates a vector of length \code{n} with values from 0 to \code{folds-1} to mark train and test splits. } +\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.grid}} +} +\author{ +Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr +Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com> +} diff --git a/man/gensvm.rank.score.Rd b/man/gensvm.rank.score.Rd index a92d4be..627e60b 100644 --- a/man/gensvm.rank.score.Rd +++ b/man/gensvm.rank.score.Rd @@ -9,8 +9,11 @@ gensvm.rank.score(x) \arguments{ \item{x}{array of numeric values} } -\details{ -This function computes the ranks for the values in an array. The highest -value gets the smallest rank. Ties are broken by assigning the smallest -value. +\value{ +array with the ranks of the values in the input array. +} +\description{ +This function computes the ranks for the values in an array. +The highest value gets the smallest rank. Ties are broken by assigning the +smallest value. The smallest rank is 1. } diff --git a/man/gensvm.refit.Rd b/man/gensvm.refit.Rd index 8a711bc..cae0646 100644 --- a/man/gensvm.refit.Rd +++ b/man/gensvm.refit.Rd @@ -4,7 +4,7 @@ \alias{gensvm.refit} \title{Train an already fitted model on new data} \usage{ -gensvm.refit(fit, X, y, p = NULL, lambda = NULL, kappa = NULL, +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) @@ -12,16 +12,59 @@ gensvm.refit(fit, X, y, p = NULL, lambda = NULL, kappa = NULL, \arguments{ \item{fit}{Fitted \code{gensvm} object} -\item{X}{Data matrix of the new data} +\item{x}{Data matrix of the new data} \item{y}{Label vector of the new data} -\item{verbose}{Turn on verbose output and fit progress. If NULL (the -default) the value from the fitted model is chosen.} +\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] diff --git a/man/gensvm.train.test.split.Rd b/man/gensvm.train.test.split.Rd index fe2b1fb..261f7d1 100644 --- a/man/gensvm.train.test.split.Rd +++ b/man/gensvm.train.test.split.Rd @@ -27,6 +27,14 @@ of 0.25 will be used.} \item{shuffle}{shuffle the rows or not} \item{random.state}{seed for the random number generator (int)} + +\item{return.idx}{whether or not to return the indices in the output} +} +\value{ +a list with \code{x.train} and \code{x.test} splits of the \code{x} +array provided. If \code{y} is provided, also \code{y.train} and +\code{y.test}. If \code{return.idx} is TRUE, also \code{idx.train} and +\code{idx.test}. } \description{ Often it is desirable to split a dataset into a training and diff --git a/man/gensvm.validate.param.grid.Rd b/man/gensvm.validate.param.grid.Rd index 69882fe..7deacfd 100644 --- a/man/gensvm.validate.param.grid.Rd +++ b/man/gensvm.validate.param.grid.Rd @@ -6,4 +6,12 @@ \usage{ gensvm.validate.param.grid(df) } +\value{ +TRUE if all values pass their respective conditions, FALSE +otherwise. +} +\description{ +Internal function to validate all parameters in a parameter +grid. +} \keyword{internal} diff --git a/man/gensvm.validate.params.Rd b/man/gensvm.validate.params.Rd index 8e50137..ca6ddab 100644 --- a/man/gensvm.validate.params.Rd +++ b/man/gensvm.validate.params.Rd @@ -7,4 +7,12 @@ gensvm.validate.params(p = NULL, kappa = NULL, lambda = NULL, epsilon = NULL, gamma = NULL, weights = NULL, kernel = NULL, ...) } +\value{ +TRUE if all values pass their respective conditions, FALSE +otherwise. +} +\description{ +Internal function used to validate the parameters passed to the +gensvm() function. +} \keyword{internal} diff --git a/man/plot.gensvm.Rd b/man/plot.gensvm.Rd index d99c2a0..6e19228 100644 --- a/man/plot.gensvm.Rd +++ b/man/plot.gensvm.Rd @@ -4,15 +4,18 @@ \alias{plot.gensvm} \title{Plot the simplex space of the fitted GenSVM model} \usage{ -\method{plot}{gensvm}(fit, y, x.test = NULL, with.margins = TRUE, +\method{plot}{gensvm}(x, labels, newdata = NULL, with.margins = TRUE, with.shading = TRUE, with.legend = TRUE, center.plot = TRUE, xlim = NULL, ylim = NULL, ...) } \arguments{ -\item{fit}{A fitted \code{gensvm} object} +\item{x}{A fitted \code{gensvm} object} -\item{y}{the labels to color points with (if NULL the predicted labels are -used)} +\item{labels}{the labels to color points with. If this is omitted the +predicted labels are used.} + +\item{newdata}{the dataset to plot. If this is NULL the training data is +used.} \item{with.margins}{plot the margins} @@ -31,16 +34,14 @@ bounds will be used for the vertical axis and the value of center.plot will be ignored} \item{...}{further arguments are passed to the builtin plot() function} - -\item{x}{the dataset to plot (if NULL the training data is used)} } \value{ returns the object passed as input } \description{ This function creates a plot of the simplex space for a fitted -GenSVM model and the given data set, as long as the dataset consists of only -3 classes. For more than 3 classes, the simplex space is too high +GenSVM model and the given data set. This function works for dataset with +two or three classes. For more than 3 classes, the simplex space is too high dimensional to easily visualize. } \examples{ @@ -59,8 +60,14 @@ plot(fit, y) # plot only misclassified samples x.mis <- x[predict(fit) != y, ] y.mis.true <- y[predict(fit) != y] -plot(fit, x.test=x.mis) -plot(fit, y.mis.true, x.test=x.mis) +plot(fit, newdata=x.mis) +plot(fit, y.mis.true, newdata=x.mis) + +# plot a 2-d model +xx <- x[y \%in\% c('versicolor', 'virginica'), ] +yy <- y[y \%in\% c('versicolor', 'virginica')] +fit <- gensvm(xx, yy, kernel='rbf', max.iter=5000) +plot(fit) } \references{ diff --git a/man/plot.gensvm.grid.Rd b/man/plot.gensvm.grid.Rd index 44c599e..f23abda 100644 --- a/man/plot.gensvm.grid.Rd +++ b/man/plot.gensvm.grid.Rd @@ -4,10 +4,10 @@ \alias{plot.gensvm.grid} \title{Plot the simplex space of the best fitted model in the GenSVMGrid} \usage{ -\method{plot}{gensvm.grid}(grid, ...) +\method{plot}{gensvm.grid}(x, ...) } \arguments{ -\item{grid}{A \code{gensvm.grid} object trained with refit=TRUE} +\item{x}{A \code{gensvm.grid} object trained with refit=TRUE} \item{...}{further arguments are passed to the plot function} } diff --git a/man/predict.gensvm.Rd b/man/predict.gensvm.Rd index 015623f..b521872 100644 --- a/man/predict.gensvm.Rd +++ b/man/predict.gensvm.Rd @@ -4,10 +4,10 @@ \alias{predict.gensvm} \title{Predict class labels with the GenSVM model} \usage{ -\method{predict}{gensvm}(fit, newdata, add.rownames = FALSE, ...) +\method{predict}{gensvm}(object, newdata, add.rownames = FALSE, ...) } \arguments{ -\item{fit}{Fitted \code{gensvm} object} +\item{object}{Fitted \code{gensvm} object} \item{newdata}{Matrix of new data for which predictions need to be made.} diff --git a/man/predict.gensvm.grid.Rd b/man/predict.gensvm.grid.Rd index 01bf610..0c3cf2f 100644 --- a/man/predict.gensvm.grid.Rd +++ b/man/predict.gensvm.grid.Rd @@ -4,13 +4,13 @@ \alias{predict.gensvm.grid} \title{Predict class labels from the GenSVMGrid class} \usage{ -\method{predict}{gensvm.grid}(grid, newx, ...) +\method{predict}{gensvm.grid}(object, newdata, ...) } \arguments{ -\item{grid}{A \code{gensvm.grid} object trained with \code{refit=TRUE}} +\item{object}{A \code{gensvm.grid} object trained with \code{refit=TRUE}} -\item{newx}{Matrix of new values for \code{x} for which predictions need to -be computed.} +\item{newdata}{Matrix of new values for \code{x} for which predictions need +to be computed.} \item{\dots}{further arguments are passed to predict.gensvm()} } diff --git a/man/print.gensvm.Rd b/man/print.gensvm.Rd index e3367fa..d8a7046 100644 --- a/man/print.gensvm.Rd +++ b/man/print.gensvm.Rd @@ -4,10 +4,10 @@ \alias{print.gensvm} \title{Print the fitted GenSVM model} \usage{ -\method{print}{gensvm}(fit, ...) +\method{print}{gensvm}(x, ...) } \arguments{ -\item{fit}{A \code{gensvm} object to print} +\item{x}{A \code{gensvm} object to print} \item{\dots}{further arguments are ignored} } diff --git a/man/print.gensvm.grid.Rd b/man/print.gensvm.grid.Rd index 3b603c1..0a5377d 100644 --- a/man/print.gensvm.grid.Rd +++ b/man/print.gensvm.grid.Rd @@ -4,10 +4,10 @@ \alias{print.gensvm.grid} \title{Print the fitted GenSVMGrid model} \usage{ -\method{print}{gensvm.grid}(grid, ...) +\method{print}{gensvm.grid}(x, ...) } \arguments{ -\item{grid}{a \code{gensvm.grid} object to print} +\item{x}{a \code{gensvm.grid} object to print} \item{\dots}{further arguments are ignored} } |
