lssvm                package:kernlab                R Documentation

_L_e_a_s_t _S_q_u_a_r_e_s _S_u_p_p_o_r_t _V_e_c_t_o_r _M_a_c_h_i_n_e

_D_e_s_c_r_i_p_t_i_o_n:

     The 'lssvm' function is an implementation of the Least Squares
     SVM. 'lssvm' includes a reduced version of Least Squares SVM using
     a decomposition of the kernel matrix which is calculated by the
     'csi' function.

_U_s_a_g_e:

     ## S4 method for signature 'formula':
     lssvm(x, data=NULL, ..., subset, na.action = na.omit, scaled = TRUE)

     ## S4 method for signature 'vector':
     lssvm(x, ...)

     ## S4 method for signature 'matrix':
     lssvm(x, y = NULL, scaled = TRUE, kernel = "rbfdot",
     kpar = "automatic", type = NULL, tau = 0.01, tol = 0.0001, rank =
     floor(dim(x)[1]/4), delta = 40, cross = 0, fit = TRUE, ..., subset,
     na.action = na.omit)

     ## S4 method for signature 'kernelMatrix':
     lssvm(x, y, type = NULL, tau = 0.01, tol  =
     0.0001, rank = floor(dim(x)[1]/3), delta = 40, cross = 0, fit = TRUE, ...)

     ## S4 method for signature 'list':
     lssvm(x, y, scaled = TRUE, kernel = "stringdot",
     kpar = list(length=4, lambda = 0.5), type = NULL, tau = 0.01, reduced =
     TRUE, tol  = 0.0001, rank = floor(dim(x)[1]/3), delta = 40, cross = 0,
     fit = TRUE, ..., subset)

_A_r_g_u_m_e_n_t_s:

       x: a symbolic description of the model to be fit, a matrix or
          vector containing the training data when a formula interface
          is not used or a 'kernelMatrix' or a list of character
          vectors.

    data: an optional data frame containing the variables in the model.
          By default the variables are taken from the environment which
          `lssvm' is called from.

       y: a response vector with one label for each row/component of
          'x'. Can be either a factor (for classification tasks) or a
          numeric vector (for classification or regression - currently
          nor suported -).

  scaled: A logical vector indicating the variables to be scaled. If
          'scaled' is of length 1, the value is recycled as many times
          as needed and all non-binary variables are scaled. Per
          default, data are scaled internally to zero mean and unit
          variance. The center and scale values are returned and used
          for later predictions.

    type: Type of problem. Either "classification" or "regression".
          Depending on whether 'y' is a factor or not, the default
          setting for 'type' is "classification" or "regression"
          respectively, but can be overwritten by setting an explicit
          value. (regression is currently not supported)

  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:


             *  'rbfdot' Radial Basis kernel "Gaussian"

             *  'polydot' Polynomial kernel 

             *  'vanilladot' Linear kernel 

             *  'tanhdot' Hyperbolic tangent kernel 

             *  'laplacedot' Laplacian kernel 

             *  'besseldot' Bessel kernel 

             *  'anovadot' ANOVA RBF kernel 

             *  'splinedot' Spline kernel

             *  'stringdot' String kernel

          Setting the kernel parameter to "matrix" treats 'x' as a
          kernel matrix calling the 'kernelMatrix' interface.

          The kernel parameter can also be set to a user defined
          function of class kernel by passing the function name as an
          argument. 

    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 :


             *  'sigma' inverse kernel width for the Radial Basis
                kernel function "rbfdot" and the Laplacian kernel
                "laplacedot".

             *  'degree, scale, offset' for the Polynomial kernel
                "polydot"

             *  'scale, offset' for the Hyperbolic tangent kernel
                function "tanhdot"

             *  'sigma, order, degree' for the Bessel kernel
                "besseldot". 

             *  'sigma, degree' for the ANOVA kernel "anovadot".

             *  'length, lambda, normalized' for the "stringdot" kernel
                where length is the length of the strings considered,
                lambda the decay factor and normalized a logical
                parameter determining if the kernel evaluations should
                be normalized.

          Hyper-parameters for user defined kernels can be passed
          through the kpar parameter as well.

          'kpar' can also be set to the string "automatic" which uses
          the heuristics in  'sigest' to calculate a good 'sigma' value
          for the Gaussian RBF or Laplace kernel, from the data.
          (default = "automatic"). 

     tau: the regularization parameter (default 0.01) 

 reduced: if set to 'FALSE' the full linear problem of the lssvm is
          solved, when 'TRUE' a reduced method using 'csi' is used.

    rank: the maximal rank of the decomposed kernel matrix, see 'csi'

   delta: number of columns of cholesky performed in advance, see 'csi'
          (default 40)

     tol: tolerance of termination criterion for the 'csi' function,
          lower tolerance leads to more preciese approximation but may
          increase the training time and the decomposed matrix size
          (default: 0.0001)

     fit: indicates whether the fitted values should be computed and
          included in the model or not (default: 'TRUE')

   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

  subset: An index vector specifying the cases to be used in the
          training sample.  (NOTE: If given, this argument must be
          named.)

na.action: A function to specify the action to be taken if 'NA's are
          found. The default action is 'na.omit', which leads to
          rejection of cases with missing values on any required
          variable. An alternative is 'na.fail', which causes an error
          if 'NA' cases are found. (NOTE: If given, this argument must
          be named.)

     ...: additional parameters

_D_e_t_a_i_l_s:

     Least Squares Support Vector Machines are reformulation to the
     standard SVMs that lead to solving linear KKT systems. The
     algorithm is based on the minimization of a classical penalized
     least-squares cost function. The current implementation
     approximates the kernel matrix by an incomplete Cholesky
     factorization optained by the 'csi' function, thus the solution is
     an approximation to the exact solution of the lssvm optimization
     problem. The quality of the solution depends on the approximation
     and can be influenced by the "rank" , "delta", and "tol"
     parameters.

_V_a_l_u_e:

     An S4 object of class '"lssvm"' containing the fitted model,
     Accessor functions can be used to access the slots of the object
     (see examples) which include: 

   alpha: the parameters of the '"lssvm"'

    coef: the model coefficients (identical to alpha)

       b: the model offset.

 xmatrix: the training data used by the model

_A_u_t_h_o_r(_s):

     Alexandros Karatzoglou 
      alexandros.karatzoglou@ci.tuwien.ac.at

_R_e_f_e_r_e_n_c_e_s:

     *  J. A. K. Suykens and  J. Vandewalle
         _Least Squares Support Vector Machine Classifiers_
         Neural Processing Letters vol. 9, issue 3, June 1999

_S_e_e _A_l_s_o:

     'ksvm', 'gausspr', 'csi'

_E_x_a_m_p_l_e_s:

     ## simple example
     data(iris)

     lir <- lssvm(Species~.,data=iris)

     lir

     lirr <- lssvm(Species~.,data= iris, reduced = FALSE)

     lirr

     ## Using the kernelMatrix interface

     iris <- unique(iris)

     rbf <- rbfdot(0.5)

     k <- kernelMatrix(rbf, as.matrix(iris[,-5]))

     klir <- lssvm(k, iris[, 5])

     klir

     pre <- predict(klir, k)

