Skip to main content

centered_kernel_alignment

Function centered_kernel_alignment 

Source
pub fn centered_kernel_alignment(
    k1: &KernelMatrix,
    k2: &KernelMatrix,
) -> Result<AlignmentResult, AlignmentError>
Expand description

Compute the Centered Kernel Alignment (CKA) between kernel matrices k1 and k2.

CKA applies double-centering (via the centering matrix H) before alignment, making it invariant to isotropic scaling and mean shifts:

CKA(K1, K2) = HSIC(K1, K2) / sqrt(HSIC(K1, K1) * HSIC(K2, K2))