Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computation of HSIC #4

Closed
Pirazh opened this issue Jul 14, 2022 · 1 comment
Closed

Computation of HSIC #4

Pirazh opened this issue Jul 14, 2022 · 1 comment

Comments

@Pirazh
Copy link

Pirazh commented Jul 14, 2022

Hi,

Thank you for your great work. I was going through the code and notice that here you would like to make only the diagonal elements zero which is consistent with the original paper "Feature Selection via Dependence Maximization". However, torch.diag function which you used here, has different behaviors when the input is vector or a matrix. Since here it is taking a matrix as the input, its output is a vector containing diagonal elements and kernel_XX - torch.diag(kernel_XX) subtracts the diagonal elements from all the elements in the corresponding column. The fix would be to change this line to kernel_XX - torch.diag(torch.diag(kernel_XX)). Could you please confirm this?

@Cogito2012
Copy link
Owner

Cogito2012 commented Jul 14, 2022

@Pirazh Thanks for pointing out this issue. You are right after I referred to the torch.diag definition from pytorch doc. Since my HSIC omputation was adapted from the ICML'21 work ReBias where their HSIC code is here, I believe they have exactly the same issue as this one. I'll update the code later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants