diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-05 15:35:57 -0400 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-05 15:35:57 -0400 |
| commit | 2224f89c05a5540102101b1310e120c12d533028 (patch) | |
| tree | bb5ea2d6f826cade03aa697e17f7f03d300cc475 | |
| parent | fix type of ZV matrix (diff) | |
| download | rgensvm-2224f89c05a5540102101b1310e120c12d533028.tar.gz rgensvm-2224f89c05a5540102101b1310e120c12d533028.zip | |
don't run a bunch of examples to make check faster
| -rw-r--r-- | R/coef.gensvm.grid.R | 2 | ||||
| -rw-r--r-- | R/gensvm.R | 4 | ||||
| -rw-r--r-- | R/gensvm.grid.R | 4 | ||||
| -rw-r--r-- | R/gensvm.refit.R | 2 | ||||
| -rw-r--r-- | R/plot.gensvm.grid.R | 2 | ||||
| -rw-r--r-- | R/predict.gensvm.grid.R | 2 | ||||
| -rw-r--r-- | R/print.gensvm.grid.R | 2 | ||||
| -rw-r--r-- | man/coef.gensvm.grid.Rd | 2 | ||||
| -rw-r--r-- | man/gensvm.grid.Rd | 4 | ||||
| -rw-r--r-- | man/gensvm.refit.Rd | 2 | ||||
| -rw-r--r-- | man/plot.gensvm.grid.Rd | 2 | ||||
| -rw-r--r-- | man/predict.gensvm.grid.Rd | 2 | ||||
| -rw-r--r-- | man/print.gensvm.grid.Rd | 2 |
13 files changed, 30 insertions, 2 deletions
diff --git a/R/coef.gensvm.grid.R b/R/coef.gensvm.grid.R index 48b2a76..f9908ba 100644 --- a/R/coef.gensvm.grid.R +++ b/R/coef.gensvm.grid.R @@ -26,11 +26,13 @@ #' @importFrom stats coef #' #' @examples +#' \dontrun{ #' x <- iris[, -5] #' y <- iris[, 5] #' #' grid <- gensvm.grid(x, y) #' pg <- coef(grid) +#' } #' coef.gensvm.grid <- function(object, ...) { @@ -107,8 +107,8 @@ #' fit <- gensvm(x, y, max.iter=1000) #' #' # Nonlinear training -#' fit <- gensvm(x, y, kernel='rbf', max.iter=5000) -#' fit <- gensvm(x, y, kernel='poly', degree=2, gamma=1.0, max.iter=5000) +#' fit <- gensvm(x, y, kernel='rbf', max.iter=1000) +#' fit <- gensvm(x, y, kernel='poly', degree=2, gamma=1.0, max.iter=1000) #' #' # Setting the random seed and comparing results #' fit <- gensvm(x, y, random.seed=123) diff --git a/R/gensvm.grid.R b/R/gensvm.grid.R index 2bf673e..8fa187e 100644 --- a/R/gensvm.grid.R +++ b/R/gensvm.grid.R @@ -130,8 +130,10 @@ #' x <- iris[, -5] #' y <- iris[, 5] #' +#' \dontrun{ #' # use the default parameter grid #' grid <- gensvm.grid(x, y, verbose=TRUE) +#' } #' #' # use a smaller parameter grid #' pg <- expand.grid(p=c(1.0, 1.5, 2.0), kappa=c(-0.9, 1.0), epsilon=c(1e-3)) @@ -140,6 +142,7 @@ #' # print the result #' print(grid) #' +#' \dontrun{ #' # Using a custom scoring function (accuracy as percentage) #' acc.pct <- function(yt, yp) { return (100 * sum(yt == yp) / length(yt)) } #' grid <- gensvm.grid(x, y, scoring=acc.pct) @@ -148,6 +151,7 @@ #' pg <- expand.grid(kernel=c('rbf'), gamma=c(1e-2, 1e-1, 1, 1e1, 1e2), #' lambda=c(1e-8, 1e-6), max.iter=c(5000)) #' grid <- gensvm.grid(x, y, param.grid=pg, verbose=2) +#' } #' gensvm.grid <- function(x, y, param.grid='tiny', refit=TRUE, scoring=NULL, cv=3, verbose=0, return.train.score=TRUE) diff --git a/R/gensvm.refit.R b/R/gensvm.refit.R index f3b818b..54040f4 100644 --- a/R/gensvm.refit.R +++ b/R/gensvm.refit.R @@ -60,9 +60,11 @@ #' fit <- gensvm(x, y) #' fit2 <- gensvm.refit(fit, x, y, epsilon=1e-8) #' +#' \dontrun{ #' # refit a model returned by a grid search #' grid <- gensvm.grid(x, y) #' fit <- gensvm.refit(fit, x, y, epsilon=1e-8) +#' } #' #' # refit on different data #' idx <- runif(nrow(x)) > 0.5 diff --git a/R/plot.gensvm.grid.R b/R/plot.gensvm.grid.R index 6a34024..c755c3c 100644 --- a/R/plot.gensvm.grid.R +++ b/R/plot.gensvm.grid.R @@ -25,11 +25,13 @@ #' @export #' #' @examples +#' \dontrun{ #' x <- iris[, -5] #' y <- iris[, 5] #' #' grid <- gensvm.grid(x, y) #' plot(grid, x) +#' } #' plot.gensvm.grid <- function(x, ...) { diff --git a/R/predict.gensvm.grid.R b/R/predict.gensvm.grid.R index acc838f..d6f5e06 100644 --- a/R/predict.gensvm.grid.R +++ b/R/predict.gensvm.grid.R @@ -35,6 +35,7 @@ #' @importFrom stats predict #' #' @examples +#' \dontrun{ #' x <- iris[, -5] #' y <- iris[, 5] #' @@ -43,6 +44,7 @@ #' #' # predict training sample #' y.hat <- predict(grid, x) +#' } #' predict.gensvm.grid <- function(object, newdata, ...) { diff --git a/R/print.gensvm.grid.R b/R/print.gensvm.grid.R index 3e1bb69..d0755ca 100644 --- a/R/print.gensvm.grid.R +++ b/R/print.gensvm.grid.R @@ -25,12 +25,14 @@ #' @export #' #' @examples +#' \dontrun{ #' x <- iris[, -5] #' y <- iris[, 5] #' #' # fit a grid search and print the resulting object #' grid <- gensvm.grid(x, y) #' print(grid) +#' } #' print.gensvm.grid <- function(x, ...) { diff --git a/man/coef.gensvm.grid.Rd b/man/coef.gensvm.grid.Rd index 744809f..48cf48d 100644 --- a/man/coef.gensvm.grid.Rd +++ b/man/coef.gensvm.grid.Rd @@ -18,11 +18,13 @@ The parameter grid of the GenSVMGrid object as a data frame. Returns the parameter grid of a \code{gensvm.grid} object. } \examples{ +\dontrun{ x <- iris[, -5] y <- iris[, 5] grid <- gensvm.grid(x, y) pg <- coef(grid) +} } \references{ diff --git a/man/gensvm.grid.Rd b/man/gensvm.grid.Rd index 147c044..a19b631 100644 --- a/man/gensvm.grid.Rd +++ b/man/gensvm.grid.Rd @@ -131,8 +131,10 @@ be the same as the param.grid in the input. x <- iris[, -5] y <- iris[, 5] +\dontrun{ # use the default parameter grid grid <- gensvm.grid(x, y, verbose=TRUE) +} # use a smaller parameter grid pg <- expand.grid(p=c(1.0, 1.5, 2.0), kappa=c(-0.9, 1.0), epsilon=c(1e-3)) @@ -141,6 +143,7 @@ grid <- gensvm.grid(x, y, param.grid=pg) # print the result print(grid) +\dontrun{ # Using a custom scoring function (accuracy as percentage) acc.pct <- function(yt, yp) { return (100 * sum(yt == yp) / length(yt)) } grid <- gensvm.grid(x, y, scoring=acc.pct) @@ -149,6 +152,7 @@ grid <- gensvm.grid(x, y, scoring=acc.pct) pg <- expand.grid(kernel=c('rbf'), gamma=c(1e-2, 1e-1, 1, 1e1, 1e2), lambda=c(1e-8, 1e-6), max.iter=c(5000)) grid <- gensvm.grid(x, y, param.grid=pg, verbose=2) +} } \references{ diff --git a/man/gensvm.refit.Rd b/man/gensvm.refit.Rd index cae0646..aa260ca 100644 --- a/man/gensvm.refit.Rd +++ b/man/gensvm.refit.Rd @@ -73,9 +73,11 @@ y <- iris[, 5] fit <- gensvm(x, y) fit2 <- gensvm.refit(fit, x, y, epsilon=1e-8) +\dontrun{ # refit a model returned by a grid search grid <- gensvm.grid(x, y) fit <- gensvm.refit(fit, x, y, epsilon=1e-8) +} # refit on different data idx <- runif(nrow(x)) > 0.5 diff --git a/man/plot.gensvm.grid.Rd b/man/plot.gensvm.grid.Rd index f23abda..a3aa4d9 100644 --- a/man/plot.gensvm.grid.Rd +++ b/man/plot.gensvm.grid.Rd @@ -20,11 +20,13 @@ model in the provided GenSVMGrid object. See the documentation for \code{\link{plot.gensvm}} for more information. } \examples{ +\dontrun{ x <- iris[, -5] y <- iris[, 5] grid <- gensvm.grid(x, y) plot(grid, x) +} } \references{ diff --git a/man/predict.gensvm.grid.Rd b/man/predict.gensvm.grid.Rd index 0c3cf2f..a61362e 100644 --- a/man/predict.gensvm.grid.Rd +++ b/man/predict.gensvm.grid.Rd @@ -27,6 +27,7 @@ this model is only available if \code{refit=TRUE} was specified in the \code{\link{gensvm.grid}} call (the default). } \examples{ +\dontrun{ x <- iris[, -5] y <- iris[, 5] @@ -35,6 +36,7 @@ grid <- gensvm.grid(x, y) # predict training sample y.hat <- predict(grid, x) +} } \references{ diff --git a/man/print.gensvm.grid.Rd b/man/print.gensvm.grid.Rd index 0a5377d..1f19737 100644 --- a/man/print.gensvm.grid.Rd +++ b/man/print.gensvm.grid.Rd @@ -18,12 +18,14 @@ returns the object passed as input Prints the summary of the fitted GenSVMGrid model } \examples{ +\dontrun{ x <- iris[, -5] y <- iris[, 5] # fit a grid search and print the resulting object grid <- gensvm.grid(x, y) print(grid) +} } \references{ |
