diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-30 22:03:53 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-30 22:03:53 +0100 |
| commit | 4df4236f22489a6eabc51deeb0c22dce8c7748a4 (patch) | |
| tree | 6ed14d831dfda45ac8ddee7df643bc2a103121f2 /R | |
| parent | Add check for y input (diff) | |
| download | rgensvm-4df4236f22489a6eabc51deeb0c22dce8c7748a4.tar.gz rgensvm-4df4236f22489a6eabc51deeb0c22dce8c7748a4.zip | |
Return invisibly on error
Diffstat (limited to 'R')
| -rw-r--r-- | R/gensvm.R | 4 | ||||
| -rw-r--r-- | R/gensvm.grid.R | 6 | ||||
| -rw-r--r-- | R/plot.gensvm.R | 2 |
3 files changed, 6 insertions, 6 deletions
@@ -138,10 +138,10 @@ gensvm <- function(X, y, p=1.0, lambda=1e-8, kappa=0.0, epsilon=1e-6, if (gamma == 'auto') gamma <- 1.0/n.features - if (!gensvm.validate.params(p=p, kappa=kappa, lambda=lambda, + if (!gensvm.validate.params(p=p, kappa=kappa, lambda=lambda, epsilon=epsilon, gamma=gamma, weights=weights, kernel=kernel)) - invisible(NULL) + return(invisible(NULL)) # Convert weights to index weight.idx <- which(c("unit", "group") == weights) diff --git a/R/gensvm.grid.R b/R/gensvm.grid.R index 8f875a3..c541ea0 100644 --- a/R/gensvm.grid.R +++ b/R/gensvm.grid.R @@ -157,8 +157,8 @@ gensvm.grid <- function(X, y, param.grid='tiny', refit=TRUE, scoring=NULL, cv=3, n.classes <- length(unique(y)) if (n.objects != length(y)) { - cat("Error: X and y are not the same length.\n") - invisible(NULL) + cat("Error: x and y are not the same length.\n") + return(invisible(NULL)) } if (is.character(param.grid)) { @@ -173,7 +173,7 @@ gensvm.grid <- function(X, y, param.grid='tiny', refit=TRUE, scoring=NULL, cv=3, # Validate the range of the values for the gridsearch if (!gensvm.validate.param.grid(param.grid)) - invisible(NULL) + return(invisible(NULL)) # Sort the parameter grid for efficient warm starts param.grid <- gensvm.sort.param.grid(param.grid) diff --git a/R/plot.gensvm.R b/R/plot.gensvm.R index e79881f..ac40ccf 100644 --- a/R/plot.gensvm.R +++ b/R/plot.gensvm.R @@ -65,7 +65,7 @@ plot.gensvm <- function(fit, x, y.true=NULL, with.margins=TRUE, { if (!(fit$n.classes %in% c(2,3))) { cat("Error: Can only plot with 2 or 3 classes\n") - invisible(NULL) + return(invisible(NULL)) } # Sanity check |
