aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2018-03-30 17:36:06 +0100
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2018-03-30 17:36:06 +0100
commitd87788f7e37c3c63ed0ad06c65a602ab6b744dd1 (patch)
tree571321ce3a055de8ef41a306c595a0f1f00406c9 /R
parentset feature names for coef result (diff)
downloadrgensvm-d87788f7e37c3c63ed0ad06c65a602ab6b744dd1.tar.gz
rgensvm-d87788f7e37c3c63ed0ad06c65a602ab6b744dd1.zip
return invisibly
Diffstat (limited to 'R')
-rw-r--r--R/gensvm.R2
-rw-r--r--R/gensvm.grid.R4
-rw-r--r--R/plot.gensvm.R8
-rw-r--r--R/predict.gensvm.R6
4 files changed, 10 insertions, 10 deletions
diff --git a/R/gensvm.R b/R/gensvm.R
index b70be78..41a08d7 100644
--- a/R/gensvm.R
+++ b/R/gensvm.R
@@ -136,7 +136,7 @@ gensvm <- function(X, y, p=1.0, lambda=1e-8, kappa=0.0, epsilon=1e-6,
if (!gensvm.validate.params(p=p, kappa=kappa, lambda=lambda,
epsilon=epsilon, gamma=gamma, weights=weights,
kernel=kernel))
- return(NULL)
+ 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 fa4f4fe..8f875a3 100644
--- a/R/gensvm.grid.R
+++ b/R/gensvm.grid.R
@@ -158,7 +158,7 @@ gensvm.grid <- function(X, y, param.grid='tiny', refit=TRUE, scoring=NULL, cv=3,
if (n.objects != length(y)) {
cat("Error: X and y are not the same length.\n")
- return(NULL)
+ 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))
- return(NULL)
+ 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 a41c91e..e79881f 100644
--- a/R/plot.gensvm.R
+++ b/R/plot.gensvm.R
@@ -65,14 +65,14 @@ 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")
- return(NULL)
+ invisible(NULL)
}
# Sanity check
if (ncol(x) != fit$n.features) {
cat("Error: Number of features of fitted model and testing data
disagree.\n")
- return(NULL)
+ invisible(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(NULL)
+ invisible(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(NULL)
+ invisible(NULL)
}
x <- as.matrix(x)
diff --git a/R/predict.gensvm.R b/R/predict.gensvm.R
index 133b40e..558f80b 100644
--- a/R/predict.gensvm.R
+++ b/R/predict.gensvm.R
@@ -54,7 +54,7 @@ predict.gensvm <- function(fit, x.test, ...)
if (ncol(x.test) != fit$n.features) {
cat("Error: Number of features of fitted model and testing",
"data disagree.\n")
- return(NULL)
+ invisible(NULL)
}
x.train <- fit$X.train
@@ -62,12 +62,12 @@ predict.gensvm <- function(fit, x.test, ...)
cat("Error: The training data is needed to compute predictions for ",
"nonlinear GenSVM. This data is not present in the fitted ",
"model!\n", sep="")
- return(NULL)
+ invisible(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")
- return(NULL)
+ invisible(NULL)
}
if (fit$kernel == 'linear') {