diff options
Diffstat (limited to 'R/print.gensvm.R')
| -rw-r--r-- | R/print.gensvm.R | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/R/print.gensvm.R b/R/print.gensvm.R index 724806b..54397da 100644 --- a/R/print.gensvm.R +++ b/R/print.gensvm.R @@ -2,7 +2,7 @@ #' #' @description Prints a short description of the fitted GenSVM model #' -#' @param fit A \code{gensvm} object to print +#' @param x A \code{gensvm} object to print #' @param \dots further arguments are ignored #' #' @return returns the object passed as input. This can be useful for chaining @@ -36,41 +36,41 @@ #' fit <- gensvm(x, y) #' predict(print(fit), x) #' -print.gensvm <- function(fit, ...) +print.gensvm <- function(x, ...) { cat("Data:\n") - cat("\tn.objects:", fit$n.objects, "\n") - cat("\tn.features:", fit$n.features, "\n") - cat("\tn.classes:", fit$n.classes, "\n") - if (is.factor(fit$classes)) - cat("\tclasses:", levels(fit$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:", fit$classes, "\n") + cat("\tclasses:", x$classes, "\n") cat("Parameters:\n") - cat("\tp:", fit$p, "\n") - cat("\tlambda:", fit$lambda, "\n") - cat("\tkappa:", fit$kappa, "\n") - cat("\tepsilon:", fit$epsilon, "\n") - cat("\tweights:", fit$weights, "\n") - cat("\tmax.iter:", fit$max.iter, "\n") - cat("\trandom.seed:", fit$random.seed, "\n") - if (is.factor(fit$kernel)) { - cat("\tkernel:", levels(fit$kernel)[as.numeric(fit$kernel)], "\n") + cat("\tp:", x$p, "\n") + cat("\tlambda:", x$lambda, "\n") + cat("\tkappa:", x$kappa, "\n") + cat("\tepsilon:", x$epsilon, "\n") + cat("\tweights:", x$weights, "\n") + cat("\tmax.iter:", x$max.iter, "\n") + cat("\trandom.seed:", x$random.seed, "\n") + if (is.factor(x$kernel)) { + cat("\tkernel:", levels(x$kernel)[as.numeric(x$kernel)], "\n") } else { - cat("\tkernel:", fit$kernel, "\n") + cat("\tkernel:", x$kernel, "\n") } - if (fit$kernel %in% c("poly", "rbf", "sigmoid")) { - cat("\tkernel.eigen.cutoff:", fit$kernel.eigen.cutoff, "\n") - cat("\tgamma:", fit$gamma, "\n") + if (x$kernel %in% c("poly", "rbf", "sigmoid")) { + cat("\tkernel.eigen.cutoff:", x$kernel.eigen.cutoff, "\n") + cat("\tgamma:", x$gamma, "\n") } - if (fit$kernel %in% c("poly", "sigmoid")) - cat("\tcoef:", fit$coef, "\n") - if (fit$kernel == 'poly') - cat("\tdegree:", fit$degree, "\n") + if (x$kernel %in% c("poly", "sigmoid")) + cat("\tcoef:", x$coef, "\n") + if (x$kernel == 'poly') + cat("\tdegree:", x$degree, "\n") cat("Results:\n") - cat("\ttime:", fit$training.time, "\n") - cat("\tn.iter:", fit$n.iter, "\n") - cat("\tn.support:", fit$n.support, "\n") + cat("\ttime:", x$training.time, "\n") + cat("\tn.iter:", x$n.iter, "\n") + cat("\tn.support:", x$n.support, "\n") - invisible(fit) + invisible(x) } |
