Skip to content
New issue

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

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

Already on GitHub? # to your account

关于alignment和uniformity? #2

Open
githubXin123 opened this issue May 15, 2022 · 6 comments
Open

关于alignment和uniformity? #2

githubXin123 opened this issue May 15, 2022 · 6 comments

Comments

@githubXin123
Copy link

githubXin123 commented May 15, 2022

作者您好。最近刚接触对比学习,您文章中有分析alignment和uniformity这两个指标,但我在代码部分没找到。不知道是我没找到,还是这部分是和模型分开单独计算、分析的?

@junxia97
Copy link
Owner

您好,感谢您对我们工作的兴趣。我以伪代码的形式展示出我们是如何计算alignment和uniformity (该部分是我们单独计算、分析的):

# bsz : batch size (number of positive pairs)
# d   : latent dim
# x   : Tensor, shape=[bsz, d]
#       latents for one side of positive pairs
# y   : Tensor, shape=[bsz, d]
#       latents for the other side of positive pairs

def align_metric(x, y, alpha=2):
    return (x - y).norm(p=2, dim=1).pow(alpha).mean()

def uniform_metric(x, t=2):
    return torch.pdist(x, p=2).pow(2).mul(-t).exp().mean().log()

@githubXin123
Copy link
Author

好的,谢谢。

@XuexiongLuoMQ
Copy link

您好,我想问下您代码中deepinformax.py文件是用来做什么的呢?

@junxia97
Copy link
Owner

您好,deepinformax.py文件只是对其他无监督图表征学习方法的复现。

@mpanpan
Copy link

mpanpan commented Jun 22, 2022

你好,我想问下这个代码的环境是什么版本的呢?使用torch1.10+cu111不太行

@junxia97
Copy link
Owner

junxia97 commented Jul 3, 2022

  • Python 3.7.4
  • PyTorch 1.7.0
  • torch_geometric 1.5.0
    不同类别实验的具体配置不一样,你可以参考下每个文件夹下的readme文件

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

No branches or pull requests

4 participants