diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-30 17:25:47 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2018-03-30 17:25:47 +0100 |
| commit | 6529d39742e335039e3238b22c66eea8a69629ef (patch) | |
| tree | 2cd5c5563ec234042c3f48df40160cc390889c73 /R | |
| parent | Add plot function for binary data (diff) | |
| download | rgensvm-6529d39742e335039e3238b22c66eea8a69629ef.tar.gz rgensvm-6529d39742e335039e3238b22c66eea8a69629ef.zip | |
set feature names for coef result
Diffstat (limited to 'R')
| -rw-r--r-- | R/coef.gensvm.R | 9 | ||||
| -rw-r--r-- | R/gensvm.R | 3 |
2 files changed, 8 insertions, 4 deletions
diff --git a/R/coef.gensvm.R b/R/coef.gensvm.R index 09febc2..60317aa 100644 --- a/R/coef.gensvm.R +++ b/R/coef.gensvm.R @@ -2,7 +2,7 @@ #' #' @description Returns the model coefficients of the GenSVM object #' -#' @param object a \code{gensvm} object +#' @param fit a \code{gensvm} object #' @param \dots further arguments are ignored #' #' @return The coefficients of the GenSVM model. This is a matrix of size @@ -35,7 +35,10 @@ #' fit <- gensvm(x, y) #' V <- coef(fit) #' -coef.gensvm <- function(object, ...) +coef.gensvm <- function(fit, ...) { - return(object$V) + V <- fit$V + name <- c("translation", fit$feature.names) + rownames(V) <- name + return(V) } @@ -182,7 +182,8 @@ gensvm <- function(X, y, p=1.0, lambda=1e-8, kappa=0.0, epsilon=1e-6, classes = classes, V = out$V, n.iter = out$n.iter, n.support = out$n.support, training.time = out$training.time, - X.train = if(kernel == 'linear') NULL else X) + X.train = if(kernel == 'linear') NULL else X, + feature.names = colnames(X)) class(object) <- "gensvm" return(object) |
