diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-28 13:41:14 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-28 13:41:14 +0100 |
| commit | 75d6ed3e5d919b4e5b7bd1e81283131c92530d26 (patch) | |
| tree | 907f9de5769412c25e61d0c67a50089e6d8e1d6e /R/gensvm.R | |
| parent | Make sure we use "weights" everywhere instead of "weight" (diff) | |
| download | rgensvm-75d6ed3e5d919b4e5b7bd1e81283131c92530d26.tar.gz rgensvm-75d6ed3e5d919b4e5b7bd1e81283131c92530d26.zip | |
Validate params in gensvm() function
Parameter validation was only done for some parameters in the
gensvm() function and for the parameter grid in gensvm.grid()
With this commit the parameters will be tested properly for
both functions.
Diffstat (limited to 'R/gensvm.R')
| -rw-r--r-- | R/gensvm.R | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -133,21 +133,16 @@ 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, + epsilon=epsilon, gamma=gamma, weights=weights, + kernel=kernel)) + return(NULL) + # Convert weights to index weight.idx <- which(c("unit", "group") == weights) - if (length(weight.idx) == 0) { - cat("Error: Incorrect weight specification. ", - "Valid options are 'unit' and 'group'") - return - } # Convert kernel to index (remember off-by-one for R vs. C) kernel.idx <- which(c("linear", "poly", "rbf", "sigmoid") == kernel) - 1 - if (length(kernel.idx) == 0) { - cat("Error: Incorrect kernel specification. ", - "Valid options are 'linear', 'poly', 'rbf', and 'sigmoid'") - return - } seed.rows <- if(is.null(seed.V)) -1 else nrow(seed.V) seed.cols <- if(is.null(seed.V)) -1 else ncol(seed.V) |
