Kernel modules
causalai.models.common.CI_tests.kernels
- class causalai.models.common.CI_tests.kernels.KernelBase(**kargs)
- __init__(**kargs)
- static centered_kernel(K: ndarray) ndarray
Remove data mean by returning HKH, where H=I-1/n In the linear setting where K=XX', simple linear algebra shows that HKH is essentially the kernel matrix (X-mu)(X-mu)' after centering the data matrix X, where each row is a sample. When using a non-linear kernel K, HKH centers the data in the kernel representation space.
- abstract kernel(X: ndarray, Y: ndarray | None = None) ndarray
Returns the nxn kernel matrix
- kernel_matrix_regression(Kz: ndarray, epsilon: float = 1e-05) ndarray
Closed form Kernel Matrix Regression for computing the regression coefficient A.K.A that predicts K using Kz. Here A = Kz^-1, we use epsilon to avoid degenerate cases. See slide 14 of https://members.cbio.mines-paristech.fr/~jvert/talks/070529asmda/asmda.pdf for explaination.