File: as.kernelMatrix.Rd

package info (click to toggle)
r-cran-kernlab 0.9-33-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,216 kB
  • sloc: cpp: 6,011; ansic: 935; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,220 bytes parent folder | download | duplicates (5)
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
45
46
47
48
\name{as.kernelMatrix}
\docType{methods}
\alias{kernelMatrix-class}
\alias{as.kernelMatrix}
\alias{as.kernelMatrix-methods}
\alias{as.kernelMatrix,matrix-method}
\title{Assing kernelMatrix class to matrix objects}

\description{\code{as.kernelMatrix} in package \pkg{kernlab} can be used 
  to coerce the kernelMatrix class to matrix objects representing a
  kernel matrix.  These matrices can then be used with the kernelMatrix
  interfaces which most of the functions in \pkg{kernlab} support.}

\usage{
\S4method{as.kernelMatrix}{matrix}(x, center = FALSE)
}
\arguments{
  \item{x}{matrix to be assigned the \code{kernelMatrix} class }
  \item{center}{center the kernel matrix in feature space (default: FALSE) }
}

\author{
  Alexandros Karatzoglou \cr
    \email{alexandros.karatzoglou@ci.tuwien.ac.at}
    }

\seealso{\code{\link{kernelMatrix}}, \code{\link{dots}}}
    
\keyword{methods}


\examples{
## Create toy data
x <- rbind(matrix(rnorm(10),,2),matrix(rnorm(10,mean=3),,2))
y <- matrix(c(rep(1,5),rep(-1,5)))

### Use as.kernelMatrix to label the cov. matrix as a kernel matrix
### which is eq. to using a linear kernel 

K <- as.kernelMatrix(crossprod(t(x)))

K

svp2 <- ksvm(K, y, type="C-svc")

svp2

}