diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-04 15:06:33 -0400 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-04-04 15:06:33 -0400 |
| commit | de17a6d755e9369a91abdb06562ee93d7b323bbd (patch) | |
| tree | cbede010da1046ee6627143aa0e41d8ec0fbb09e /R/print.gensvm.grid.R | |
| parent | Add importFrom statements (diff) | |
| download | rgensvm-de17a6d755e9369a91abdb06562ee93d7b323bbd.tar.gz rgensvm-de17a6d755e9369a91abdb06562ee93d7b323bbd.zip | |
Adhere to generic function signatures
Diffstat (limited to 'R/print.gensvm.grid.R')
| -rw-r--r-- | R/print.gensvm.grid.R | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/R/print.gensvm.grid.R b/R/print.gensvm.grid.R index 5e4c5da..3e1bb69 100644 --- a/R/print.gensvm.grid.R +++ b/R/print.gensvm.grid.R @@ -2,7 +2,7 @@ #' #' @description Prints the summary of the fitted GenSVMGrid model #' -#' @param grid a \code{gensvm.grid} object to print +#' @param x a \code{gensvm.grid} object to print #' @param \dots further arguments are ignored #' #' @return returns the object passed as input @@ -32,38 +32,38 @@ #' grid <- gensvm.grid(x, y) #' print(grid) #' -print.gensvm.grid <- function(grid, ...) +print.gensvm.grid <- function(x, ...) { cat("Data:\n") - cat("\tn.objects:", grid$n.objects, "\n") - cat("\tn.features:", grid$n.features, "\n") - cat("\tn.classes:", grid$n.classes, "\n") - if (is.factor(grid$classes)) - cat("\tclasses:", levels(grid$classes), "\n") + cat("\tn.objects:", x$n.objects, "\n") + cat("\tn.features:", x$n.features, "\n") + cat("\tn.classes:", x$n.classes, "\n") + if (is.factor(x$classes)) + cat("\tclasses:", levels(x$classes), "\n") else - cat("\tclasses:", grid$classes, "\n") + cat("\tclasses:", x$classes, "\n") cat("Config:\n") - cat("\tNumber of cv splits:", grid$n.splits, "\n") - not.run <- sum(is.na(grid$cv.results$rank.test.score)) + cat("\tNumber of cv splits:", x$n.splits, "\n") + not.run <- sum(is.na(x$cv.results$rank.test.score)) if (not.run > 0) { - cat("\tParameter grid size:", dim(grid$param.grid)[1]) + cat("\tParameter grid size:", dim(x$param.grid)[1]) cat(" (", not.run, " incomplete)", sep="") cat("\n") } else { - cat("\tParameter grid size:", dim(grid$param.grid)[1], "\n") + cat("\tParameter grid size:", dim(x$param.grid)[1], "\n") } cat("Results:\n") - cat("\tTotal grid search time:", grid$total.time, "\n") - if (!is.na(grid$best.index)) { - best <- grid$cv.results[grid$best.index, ] + cat("\tTotal grid search time:", x$total.time, "\n") + if (!is.na(x$best.index)) { + best <- x$cv.results[x$best.index, ] cat("\tBest mean test score:", best$mean.test.score, "\n") cat("\tBest mean fit time:", best$mean.fit.time, "\n") - for (name in colnames(grid$best.params)) { - val <- grid$best.params[[name]] + for (name in colnames(x$best.params)) { + val <- x$best.params[[name]] val <- if(is.factor(val)) levels(val)[val] else val cat("\tBest parameter", name, "=", val, "\n") } } - invisible(grid) + invisible(x) } |
