Learn R Programming

kernlab (version 0.9-24)

onlearn-class: Class "onlearn"

Description

The class of objects used by the Kernel-based Online learning algorithms

Arguments

Objects from the Class

Objects can be created by calls of the form new("onlearn", ...). or by calls to the function inlearn.

Slots

kernelf:
Object of class "function" containing the used kernel function
buffer:
Object of class "numeric" containing the size of the buffer
kpar:
Object of class "list" containing the hyperparameters of the kernel function.
xmatrix:
Object of class "matrix" containing the data points (similar to support vectors)
fit:
Object of class "numeric" containing the decision function value of the last data point
onstart:
Object of class "numeric" used for indexing
onstop:
Object of class "numeric" used for indexing
alpha:
Object of class "ANY" containing the model parameters
rho:
Object of class "numeric" containing model parameter
b:
Object of class "numeric" containing the offset
pattern:
Object of class "factor" used for dealing with factors
type:
Object of class "character" containing the problem type (classification, regression, or novelty

Methods

alpha
signature(object = "onlearn"): returns the model parameters
b
signature(object = "onlearn"): returns the offset
buffer
signature(object = "onlearn"): returns the buffer size
fit
signature(object = "onlearn"): returns the last decision function value
kernelf
signature(object = "onlearn"): return the kernel function used
kpar
signature(object = "onlearn"): returns the hyper-parameters used
onlearn
signature(obj = "onlearn"): the learning function
predict
signature(object = "onlearn"): the predict function
rho
signature(object = "onlearn"): returns model parameter
show
signature(object = "onlearn"): show function
type
signature(object = "onlearn"): returns the type of problem
xmatrix
signature(object = "onlearn"): returns the stored data points

See Also

onlearn, inlearn

Examples

Run this code

## 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")

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

sign(predict(on,x))

Run the code above in your browser using DataLab