Skip to contents

It is equivalent to compute K using the normalization `X/sqrt(sum(X^2))` in Feature Space.

Usage

cosNorm(K)

Arguments

K

Kernel matrix (class "matrix").

Value

Cosine-normalized K (class "matrix").

References

Ah-Pine, J. (2010). Normalized kernels as similarity indices. In Advances in Knowledge Discovery and Data Mining: 14th Pacific-Asia Conference, PAKDD 2010, Hyderabad, India, June 21-24, 2010. Proceedings. Part II 14 (pp. 362-373). Springer Berlin Heidelberg. Link

Examples

dat <- matrix(rnorm(250),ncol=50,nrow=5)
K <- Linear(dat)
cosNorm(K)
#>             [,1]        [,2]        [,3]        [,4]        [,5]
#> [1,]  1.00000000 -0.18576970  0.14211804  0.04982009  0.17898714
#> [2,] -0.18576970  1.00000000  0.09582528 -0.20726749 -0.04930542
#> [3,]  0.14211804  0.09582528  1.00000000 -0.17213295 -0.05003129
#> [4,]  0.04982009 -0.20726749 -0.17213295  1.00000000  0.21781431
#> [5,]  0.17898714 -0.04930542 -0.05003129  0.21781431  1.00000000