📄 rvm.rd
字号:
\name{rvm}\alias{rvm}\alias{rvm-methods}\alias{rvm,formula-method}\alias{rvm,vector-method}\alias{rvm,matrix-method}\alias{show,rvm-method}\alias{predict,rvm-method}\title{Relevance Vector Machine }\description{ The Relevance Vector Machine is a Bayesian model for regression and classification of identical functional form to the support vector machine. The \code{rvm} function currently supports only regression.}\usage{\S4method{rvm}{formula}(x, data=NULL, ..., subset, na.action = na.omit)\S4method{rvm}{vector}(x, ...)\S4method{rvm}{matrix}(x, y, type="regression", kernel="rbfdot", kpar=list(sigma=0.1),alpha=1, var=0.1, var.fix=FALSE, iterations=100, verbosity=0, tol=.Machine$double.eps,minmaxdiff = 1e-3, cross = 0, fit =TRUE, subset,na.action = na.omit,...) }\arguments{ \item{x}{a symbolic description of the model to be fit. Note, that an intercept is always included, whether given in the formula or not. When not using a formula x is a matrix or vector containg the variables in the model.} \item{data}{an optional data frame containing the variables in the model. By default the variables are taken from the environment which `rvm' is called from.} \item{y}{a response vector with one label for each row/component of \code{x}. Can be either a factor (for classification tasks) or a numeric vector (for regression).} \item{type}{\code{rvm} can only be used for regression at the moment.} \item{kernel}{the kernel function used in training and predicting. This parameter can be set to any function, of class kernel, which computes a dot product between two vector arguments. kernlab provides the most popular kernel functions which can be used by setting the kernel parameter to the following strings: \itemize{ \item \code{rbfdot} (Radial Basis kernel function) \item \code{polydot} (Polynomial kernel function) \item \code{vanilladot} (Linear kernel function) \item \code{tanhdot} (Hyperbolic tangent kernel function) } The kernel parameter can also be set to a user defined function of class kernel by passing the function name as an argument. } \item{kpar}{the list of hyper-parameters (kernel parameters). This is a list which contains the parameters to be used with the kernel function. For valid parameters for existing kernels are : \itemize{ \item \code{sigma} (inverse kernel width for the Radial Basis kernel function "rbfdot") \item \code{degree, scale, offset} (for the Polynomial kernel "polydot") \item \code{scale, offset} (for the Hyperbolic tangent kernel function "tanhdot") } Hyper-parameters for user defined kernels can be passed through the kpar parameter as well.} \item{alpha}{The initial alpha vector. Can be either a vector of length equal to the number of data points or a single number.} \item{var}{the initial noise variance} \item{var.fix}{Keep noise variance fix during iterations (default: FALSE)} \item{iterations}{Number of iterations allowed (default: 100)} \item{tol}{tolerance of termination criterion} \item{minmaxdiff}{termination criteria. Stop when max difference is equall to this parameter (default:1e-3) } \item{verbosity}{print information on algorithm convergence (default = FALSE)} \item{fit}{indicates whether the fitted values should be computed and included in the model or not (default: TRUE)} \item{cross}{if a integer value k>0 is specified, a k-fold cross validation on the training data is performed to assess the quality of the model: the Mean Squared Error for regression} \item{subset}{An index vector specifying the cases to be used in the training sample. (NOTE: If given, this argument must be named.)} \item{na.action}{A function to specify the action to be taken if \code{NA}s are found. The default action is \code{na.omit}, which leads to rejection of cases with missing values on any required variable. An alternative is \code{na.fail}, which causes an error if \code{NA} cases are found. (NOTE: If given, this argument must be named.)} \item{\dots}{ additional parameters}}\details{ The Relevance Vector Machine typically leads to sparser models then the SVM. It also performs better in many cases (specially in regression). }\value{ An S4 object of class "rvm" containing the fitted model. Accessor functions can be used to access the slots of the object which include : \item{alpha}{The resulting relevance vectors} \item{alphaindex}{ The index of the resulting relevance vectors in the data matrix} \item{nRV}{Number of relevance vectors} \item{RVindex}{The indexes of the relevance vectors} \item{error}{Training error (if fit == TRUE)} ...}\references{ \item Tipping, M. E.\cr \emph{Sparse Bayesian learning and the relevance vector machine}\cr Journal of Machine Learning Research 1, 211-244\cr \url{http://www.jmlr.org/papers/volume1/tipping01a/tipping01a.pdf} }\author{ Alexandros Karatzoglou \cr\email{alexandros.karatzoglou@ci.tuwien.ac.at}}\seealso{ \code{\link{ksvm}}}\examples{# create datax <- seq(-20,20,0.1)y <- sin(x)/x + rnorm(401,sd=0.05)# train relevance vector machinefoo <- rvm(x, y)foo# print relevance vectorsalpha(foo)RVindex(foo)# predict and plotytest <- predict(foo, x)plot(x, y, type ="l")lines(x, ytest, col="red")}\keyword{regression}\keyword{nonlinear}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -