onlearn               package:kernlab               R Documentation

_K_e_r_n_e_l _O_n_l_i_n_e _L_e_a_r_n_i_n_g _a_l_g_o_r_i_t_h_m_s

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

     Online Kernel-based Learning algorithms for classification,
     novelty detection, and regression.

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

     ## S4 method for signature 'onlearn':
     onlearn(obj, x, y = NULL, nu = 0.2, lambda = 1e-04)

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

     obj: 'obj' an object of class 'onlearn' created by the
          initialization function 'inlearn' containing the kernel to be
          used during learning and the parameters of the learned model

       x: vector or matrix containing the data. Factors have to be
          numerically coded. If 'x' is a matrix the code is run
          internally one sample at the time.

       y: the class label in case of classification. Only binary
          classification is supported and class labels have to be -1 or
          +1. 

      nu: the parameter similarly to the 'nu' parameter in SVM bounds
          the training error.

  lambda: the learning rate

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

     The online algorithms are based on a simple stochastic gradient
     descent method in feature space. The state of the algorithm is
     stored in an object of class 'onlearn' and has to be passed to the
     function at each iteration.

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

     The function returns an 'S4' object of class 'onlearn' containing
     the model parameters and the last fitted value which can be
     retrieved by the accessor method 'fit'. The value returned in the
     classification and novelty detection problem is the decision
     function value phi. The accessor methods 'alpha' returns the model
     parameters.

_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:

     Kivinen J. Smola A.J. Williamson R.C. 
      _Online Learning with Kernels_
      IEEE Transactions on Signal Processing vol. 52, Issue 8, 2004
      <URL: http://mlg.anu.edu.au/~smola/papers/KivSmoWil03.pdf>

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

     'inlearn'

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

     ## create toy data set
     x <- rbind(matrix(rnorm(100),,2),matrix(rnorm(100)+3,,2))
     y <- matrix(c(rep(1,50),rep(-1,50)),,1)

     ## initialize onlearn object
     on <- inlearn(2,kernel="rbfdot",kpar=list(sigma=0.2),type="classification")

     ind <- sample(1:100,100)
     ## learn one data point at the time
     for(i in ind)
     on <- onlearn(on,x[i,],y[i],nu=0.03,lambda=0.1)

     ## or learn all the data 
     on <- onlearn(on,x[ind,],y[ind],nu=0.03,lambda=0.1)

     sign(predict(on,x))

