hzhao98 / GDCL

Graph Debiased Contrastive Learning with Joint Representation Clustering
20 stars 2 forks source link

Reproduction problem #3

Closed MaKaili closed 1 year ago

MaKaili commented 1 year ago

Hi @hzhao98,

Thanks for your great work.

I have difficulty reproducing the code by getting the following error.

File "train.py", line 384, in train_ucgl
  pos_sam_id = random.sample(range(0, class_pos.shape[0]), int(pos_size))
File "/home/.conda/envs/torch18/lib/python3.8/random.py", line 363, in sample
  raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

I have already adopted the parameters in train.py and used the pre-trained models in this repo. Please let me know how to reproduce the results in the paper, thanks a lot.

hzhao98 commented 1 year ago

Hi @hzhao98,

Thanks for your great work.

I have difficulty reproducing the code by getting the following error.

File "train.py", line 384, in train_ucgl
  pos_sam_id = random.sample(range(0, class_pos.shape[0]), int(pos_size))
File "/home/.conda/envs/torch18/lib/python3.8/random.py", line 363, in sample
  raise ValueError("Sample larger than population or is negative")
ValueError: Sample larger than population or is negative

I have already adopted the parameters in train.py and used the pre-trained models in this repo. Please let me know how to reproduce the results in the paper, thanks a lot.

Hi, this error is caused by that the number of samples in one cluster is less than the setted positive sample number, in the optimization process. The occurrence of this error has a certain randomness, you can try to rerun the program to avoid such an error. If you don't want to be confronted with it anymore, you can also appropriately reduce the setted number of positive samples. And certainly, if some similar errors happen on negative samples, you can also solve it by this way.