aboutsummaryrefslogtreecommitdiff
path: root/R/fitted.gensvm.R
blob: 81c4b02c22d4ea874c1fe283a3ec4c35397069e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#' @title Show fitted labels for the GenSVM model
#'
#' @description This function shows the fitted class labels of training data 
#' using a fitted GenSVM model.
#'
#' @param object Fitted \code{gensvm} object
#' @param \dots further arguments are passed to predict
#'
#' @return a vector of class labels, with the same type as the original class 
#' labels.
#'
#' @author
#' Gerrit J.J. van den Burg, Patrick J.F. Groenen \cr
#' Maintainer: Gerrit J.J. van den Burg <gertjanvandenburg@gmail.com>
#'
#' @references
#' Van den Burg, G.J.J. and Groenen, P.J.F. (2016). \emph{GenSVM: A Generalized 
#' Multiclass Support Vector Machine}, Journal of Machine Learning Research, 
#' 17(225):1--42. URL \url{https://jmlr.org/papers/v17/14-526.html}.
#'
#' @seealso
#' \code{\link{plot.gensvm}}, \code{\link{predict.gensvm.grid}}, 
#' \code{\link{gensvm}}, \code{\link{gensvm-package}}
#'
#' @method fitted gensvm
#'
#' @export
#'
#' @examples
#' x <- iris[, -5]
#' y <- iris[, 5]
#'
#' # fit GenSVM and compute training set predictions
#' fit <- gensvm(x, y)
#' yhat <- fitted(fit)
#'
#' # compute the accuracy with gensvm.accuracy
#' gensvm.accuracy(y, yhat)
#'
fitted.gensvm <- function(object, ...)
{
    x <- eval.parent(object$call$x)
    return(predict(object, x, ...))
}