Problems of MinibatchCKA
- Dominant language
- Jupyter Notebook
- Stars
- 17
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I find the value of unbiased HSIC is always negative, which will result in NAN when I calculate the MinibatchCKA. Will you meet this situation? Here is my code, I have reshaped the features X, Y to B * (C * H * W):
def unbiased_HSIC(X, Y):
"""Unbiased estimator of Hilbert-Schmidt Independence Criterion
Song, Le, et al. "Feature selection via dependence maximization." 2012.
"""
kernel_XX = torch.mm(X, X.T)
kernel_YY = torch.mm(Y, Y.T)
tK = kernel_XX - torch.diag(kernel_XX)
tL = kernel_YY - torch.diag(kernel_YY)
N = kernel_XX.shape[0]
hsic = (
torch.trace(tK @ tL)
+ (torch.sum(tK) * torch.sum(tL) / (N - 1) / (N - 2))
- (2 * torch.sum(tK, 0).dot(torch.sum(tL, 0)) / (N - 2))
)
return hsic / (N * (N - 3))
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.