diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-27 12:31:28 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-27 12:31:28 +0100 |
| commit | 004941896bac692d354c41a3334d20ee1d4627f7 (patch) | |
| tree | 2b11e42d8524843409e2bf8deb4ceb74c8b69347 /R/plot.gensvm.grid.R | |
| parent | updates to GenSVM C library (diff) | |
| download | rgensvm-004941896bac692d354c41a3334d20ee1d4627f7.tar.gz rgensvm-004941896bac692d354c41a3334d20ee1d4627f7.zip | |
GenSVM R package
Diffstat (limited to 'R/plot.gensvm.grid.R')
| -rw-r--r-- | R/plot.gensvm.grid.R | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/R/plot.gensvm.grid.R b/R/plot.gensvm.grid.R new file mode 100644 index 0000000..da101e6 --- /dev/null +++ b/R/plot.gensvm.grid.R @@ -0,0 +1,39 @@ +#' @title Plot the simplex space of the best fitted model in the GenSVMGrid +#' +#' @description This is a wrapper which calls the plot function for the best +#' model in the provided GenSVMGrid object. See the documentation for +#' \code{\link{plot.gensvm}} for more information. +#' +#' @param grid A \code{gensvm.grid} object trained with refit=TRUE +#' @param x the dataset to plot +#' @param ... further arguments are passed to the plot function +#' +#' @return returns the object passed as input +#' +#' @export +#' +#' @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}. +#' +#' @examples +#' x <- iris[, -5] +#' y <- iris[, 5] +#' +#' grid <- gensvm.grid(x, y) +#' plot(grid, x) +#' +plot.gensvm.grid <- function(grid, x, ...) +{ + if (is.null(grid$best.estimator)) { + cat("Error: Can't plot, the best.estimator element is NULL\n") + return + } + fit <- grid$best.estimator + return(plot(fit, x, ...)) +} |
