The Kernel Hebbian Algorithm class

Objects objects of class "kha"

Objects can be created by calls of the form new("kha", ...). or by calling the kha function.

Slots

pcv:

Object of class "matrix" containing the principal component vectors

eig:

Object of class "vector" containing the corresponding normalization values

eskm:

Object of class "vector" containing the kernel sum

kernelf:

Object of class "kfunction" containing the kernel function used

kpar:

Object of class "list" containing the kernel parameters used

xmatrix:

Object of class "matrix" containing the data matrix used

kcall:

Object of class "ANY" containing the function call

n.action:

Object of class "ANY" containing the action performed on NA

Methods

eig

signature(object = "kha"): returns the normalization values

kcall

signature(object = "kha"): returns the performed call

kernelf

signature(object = "kha"): returns the used kernel function

pcv

signature(object = "kha"): returns the principal component vectors

eskm

signature(object = "kha"): returns the kernel sum

predict

signature(object = "kha"): embeds new data

xmatrix

signature(object = "kha"): returns the used data matrix

Author

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

Examples

# another example using the iris
data(iris)
test <- sample(1:50,20)

kpc <- kha(~.,data=iris[-test,-5], kernel="rbfdot",
           kpar=list(sigma=0.2),features=2, eta=0.001, maxiter=65)

#print the principal component vectors
pcv(kpc)
#>                 [,1]          [,2]
#>   [1,] -1.513027e-03 -7.616116e-04
#>   [2,]  5.307985e-04  6.654197e-04
#>   [3,]  6.663416e-04  2.040750e-03
#>   [4,] -2.353033e-03  3.522643e-05
#>   [5,] -1.892124e-03 -6.894533e-04
#>   [6,] -1.699999e-04 -3.068335e-05
#>   [7,]  5.410381e-04  1.252217e-03
#>   [8,] -1.048368e-03 -2.820119e-04
#>   [9,] -8.509521e-05 -1.167589e-04
#>  [10,] -8.001194e-04  5.120439e-04
#>  [11,] -1.754271e-03 -1.836891e-04
#>  [12,]  1.389479e-03  2.329832e-03
#>  [13,] -1.363194e-03 -8.865659e-04
#>  [14,] -1.854861e-03 -2.606972e-04
#>  [15,] -2.380029e-03 -1.844561e-03
#>  [16,]  6.011317e-04  2.560991e-04
#>  [17,]  1.957001e-04  1.460886e-03
#>  [18,]  1.027823e-03  1.068922e-03
#>  [19,] -5.538593e-04  1.217233e-03
#>  [20,] -3.207486e-04  9.416305e-04
#>  [21,] -1.885586e-05  7.594156e-04
#>  [22,]  5.098694e-04  1.160012e-03
#>  [23,] -2.874642e-03 -1.041934e-03
#>  [24,] -1.902150e-03 -8.034690e-04
#>  [25,]  7.479552e-04  2.081367e-03
#>  [26,] -1.735840e-03 -8.531922e-04
#>  [27,] -2.245852e-03 -1.770141e-03
#>  [28,]  5.382669e-04  1.213776e-03
#>  [29,] -1.623171e-03  6.113560e-04
#>  [30,] -2.084936e-03 -4.747604e-04
#>  [31,]  3.964779e-04 -9.937597e-04
#>  [32,] -1.447874e-04  4.395376e-04
#>  [33,] -1.478894e-03 -1.732423e-03
#>  [34,]  1.735572e-03  2.834778e-04
#>  [35,] -1.630682e-03 -1.565303e-03
#>  [36,] -1.801493e-03 -9.224624e-04
#>  [37,]  2.018039e-03  2.246780e-03
#>  [38,] -4.111515e-04 -7.872569e-04
#>  [39,]  1.767581e-03  1.457853e-03
#>  [40,]  3.479615e-04  1.077958e-03
#>  [41,] -1.227501e-03 -2.053826e-04
#>  [42,]  9.280337e-04 -2.479302e-04
#>  [43,] -4.883525e-05 -1.029771e-03
#>  [44,]  2.161123e-03  1.295897e-03
#>  [45,]  1.525996e-03  1.787893e-03
#>  [46,]  1.675900e-03  2.036660e-03
#>  [47,]  1.171760e-03  2.695017e-04
#>  [48,]  8.405951e-04  1.222683e-03
#>  [49,]  9.103998e-04 -7.472765e-04
#>  [50,]  3.466360e-04  7.722211e-04
#>  [51,] -1.467128e-03 -3.222002e-04
#>  [52,]  3.739491e-05 -2.065457e-04
#>  [53,] -6.311994e-04  4.283049e-04
#>  [54,]  1.934344e-03  4.593298e-04
#>  [55,] -1.629265e-03 -2.246184e-03
#>  [56,]  1.729755e-03  1.860305e-03
#>  [57,]  1.618767e-03  2.029013e-03
#>  [58,]  2.117701e-03  1.069427e-03
#>  [59,]  2.461029e-03  2.174738e-03
#>  [60,]  1.545198e-03  2.343106e-04
#>  [61,] -1.224611e-03 -3.286287e-04
#>  [62,]  3.217761e-04 -9.332796e-04
#>  [63,]  1.351802e-03  1.875312e-03
#>  [64,]  1.007013e-03 -6.133522e-04
#>  [65,]  1.359277e-03 -2.315947e-04
#>  [66,] -6.680816e-04 -8.006943e-04
#>  [67,]  8.562623e-04  4.787942e-04
#>  [68,] -1.228032e-03 -3.401722e-04
#>  [69,] -1.151231e-03 -7.570617e-04
#>  [70,] -1.592517e-03 -2.236494e-03
#>  [71,]  2.103616e-03  4.702551e-04
#>  [72,] -4.449424e-04 -1.893273e-04
#>  [73,]  5.878488e-04  7.805691e-04
#>  [74,]  1.074330e-04 -5.701809e-04
#>  [75,]  2.042147e-03  2.040330e-03
#>  [76,] -5.915904e-04  4.915829e-05
#>  [77,] -6.673639e-05 -1.145682e-03
#>  [78,] -3.912153e-05  8.463445e-04
#>  [79,]  5.957879e-04  2.623446e-04
#>  [80,] -1.402822e-03 -1.494790e-03
#>  [81,] -1.364847e-03 -2.250518e-03
#>  [82,]  9.501659e-04  3.668602e-04
#>  [83,] -1.643414e-03 -1.240493e-03
#>  [84,]  1.918155e-03  2.028248e-03
#>  [85,]  2.347147e-03  1.981891e-03
#>  [86,] -1.440232e-03 -1.791948e-03
#>  [87,] -4.509753e-04 -6.262026e-04
#>  [88,] -1.971575e-03 -3.673802e-04
#>  [89,]  2.968894e-04 -8.471522e-04
#>  [90,] -5.045502e-04 -5.635932e-04
#>  [91,] -5.189502e-04 -1.339510e-03
#>  [92,]  3.236855e-04 -5.188495e-04
#>  [93,]  2.329975e-05 -7.574320e-04
#>  [94,]  2.144016e-03  1.053701e-03
#>  [95,]  2.462831e-03  1.654929e-03
#>  [96,]  1.648542e-03  1.819041e-03
#>  [97,] -9.357182e-04 -1.313598e-03
#>  [98,] -7.520013e-05 -3.057793e-04
#>  [99,] -1.026583e-03  2.550370e-04
#> [100,]  1.961209e-03  1.554235e-03
#> [101,]  1.173075e-03  1.296240e-03
#> [102,] -9.618967e-04 -1.868985e-03
#> [103,] -2.347579e-03 -2.418451e-03
#> [104,] -1.164284e-04 -1.322433e-03
#> [105,] -6.094483e-04 -9.003052e-04
#> [106,]  1.624686e-03  7.520491e-04
#> [107,]  4.119291e-04  6.358539e-04
#> [108,]  6.449423e-04 -7.491899e-04
#> [109,]  1.727046e-03  8.475888e-04
#> [110,] -1.649855e-03 -3.718902e-04
#> [111,] -5.514438e-04 -3.802836e-04
#> [112,]  1.203421e-03  1.955614e-04
#> [113,] -1.204342e-03 -1.404171e-03
#> [114,]  1.373317e-03  1.362039e-03
#> [115,] -1.667358e-03 -2.492856e-03
#> [116,] -1.724216e-03 -1.226850e-03
#> [117,]  2.437095e-03  8.112161e-04
#> [118,]  2.058159e-03  1.042216e-03
#> [119,] -1.069729e-03 -1.662396e-03
#> [120,] -2.315852e-06  8.100517e-04
#> [121,]  1.366967e-03  9.843986e-04
#> [122,]  5.412895e-04  1.069308e-03
#> [123,]  2.156201e-03  1.482379e-03
#> [124,]  2.170885e-03  1.308620e-03
#> [125,]  7.619988e-04  1.062731e-04
#> [126,]  1.336067e-03  9.895649e-04
#> [127,] -7.147652e-05 -1.018813e-03
#> [128,] -1.603578e-03 -2.210032e-03
#> [129,]  5.009532e-04  2.900096e-04
#> [130,]  2.591078e-03  1.745366e-03
kernelf(kpc)
#> new("rbfkernel", .Data = function (x, y = NULL) 
#> {
#>     if (!is(x, "vector")) 
#>         stop("x must be a vector")
#>     if (!is(y, "vector") && !is.null(y)) 
#>         stop("y must a vector")
#>     if (is(x, "vector") && is.null(y)) {
#>         return(1)
#>     }
#>     if (is(x, "vector") && is(y, "vector")) {
#>         if (!length(x) == length(y)) 
#>             stop("number of dimension must be the same on both data points")
#>         return(exp(sigma * (2 * crossprod(x, y) - crossprod(x) - 
#>             crossprod(y))))
#>     }
#> }, kpar = list(sigma = 0.2))
#> <bytecode: 0x564204d155f8>
#> <environment: 0x56420680cd70>
#> attr(,"kpar")
#> attr(,"kpar")$sigma
#> [1] 0.2
#> 
#> attr(,"class")
#> [1] "rbfkernel"
#> attr(,"class")attr(,"package")
#> [1] "kernlab"
eig(kpc)
#>    Comp.1    Comp.2 
#>   890.132 16082.388