Skip to main content

center_kernel_matrix

Function center_kernel_matrix 

Source
pub fn center_kernel_matrix(k: &Array2<f64>) -> Result<Array2<f64>>
Expand description

Center a kernel matrix in feature space

The centered kernel matrix is: K_c = K - 1_n K - K 1_n + 1_n K 1_n

where 1_n is the n x n matrix with all entries 1/n.

This corresponds to centering the data in the feature space without explicitly computing the feature map.

§Arguments

  • k - The kernel (Gram) matrix, shape (n, n)

§Returns

  • Result<Array2<f64>> - The centered kernel matrix