aboutsummaryrefslogtreecommitdiff
path: root/R/plot.gensvm.R
diff options
context:
space:
mode:
Diffstat (limited to 'R/plot.gensvm.R')
-rw-r--r--R/plot.gensvm.R12
1 files changed, 6 insertions, 6 deletions
diff --git a/R/plot.gensvm.R b/R/plot.gensvm.R
index 5bea7eb..ad69597 100644
--- a/R/plot.gensvm.R
+++ b/R/plot.gensvm.R
@@ -63,16 +63,16 @@ plot.gensvm <- function(fit, x, y.true=NULL, with.margins=TRUE,
with.shading=TRUE, with.legend=TRUE, center.plot=TRUE,
xlim=NULL, ylim=NULL, ...)
{
- if (fit$n.classes != 3) {
- cat("Error: Can only plot with 3 classes\n")
- return
+ if (!(fit$n.classes %in% c(2,3))) {
+ cat("Error: Can only plot with 2 or 3 classes\n")
+ return(NULL)
}
# Sanity check
if (ncol(x) != fit$n.features) {
cat("Error: Number of features of fitted model and testing data
disagree.\n")
- return
+ return(NULL)
}
x.train <- fit$X.train
@@ -80,12 +80,12 @@ plot.gensvm <- function(fit, x, y.true=NULL, with.margins=TRUE,
cat("Error: The training data is needed to plot data for ",
"nonlinear GenSVM. This data is not present in the fitted ",
"model!\n", sep="")
- return
+ return(NULL)
}
if (!is.null(x.train) && ncol(x.train) != fit$n.features) {
cat("Error: Number of features of fitted model and training data ",
"disagree.\n", sep="")
- return
+ return(NULL)
}
x <- as.matrix(x)