CDAC-plus icon indicating copy to clipboard operation
CDAC-plus copied to clipboard

dynamic thresholds

Open xuebaliang opened this issue 5 years ago • 6 comments

hello, I have some question about u and v in your code. You say they are dynamic in your paper, but it seems that they are fixed in your code. Therefore, can you supply the dynamic version to me? Thanks!!!

xuebaliang avatar Feb 10 '20 15:02 xuebaliang

Hi

Dynamic upper and lower threshold will update during training, as shown in .ipynb file.

You can check the implement of original DAC[Chang_2017_ICCV] algorithm.

We share the same threshold mechanism.

Liang Chen [email protected] 於 2020年2月10日 週一 上午10:59 寫道:

hello, I have some question about u and v in your code. You say they are dynamic in your paper, but it seems that they are fixed in your code. Therefore, can you supply the dynamic version to me? Thanks!!!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/thuiar/CDAC-plus/issues/2?email_source=notifications&email_token=ABKMZG3TBDPKE7MVRQUPK5TRCF2URA5CNFSM4KSQY6JKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IMJPNQQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMZG2AS6VGA62LVERVJH3RCF2URANCNFSM4KSQY6JA .

tnlin avatar Feb 10 '20 19:02 tnlin

oh oh, thanks for your reply. I see the dynamic setting in experiment.py file. Then I have another question: label_mat[labels==-1, :] = -1 label_mat[:, labels==-1] = -1 label_mat[label_mat==0] = 0 label_mat[label_mat==1] = 1 pos_mask = (sim_mat > u_threshold).type(torch.cuda.FloatTensor) neg_mask = (sim_mat < l_threshold).type(torch.cuda.FloatTensor) pos_mask[label_mat==1] = 1 neg_mask[label_mat==0] = 1 pos_entropy = -torch.log(torch.clamp(sim_mat, eps, 1.0)) * pos_mask neg_entropy = -torch.log(torch.clamp(1-sim_mat, eps, 1.0)) * neg_mask loss = pos_entropy.mean() + neg_entropy.mean() + u_threshold - l_threshold

above codes seem to indicate that the cross entropy is still restricted in known true labels, but does not support from these high similar pair points. This is inconsistent with the definition of Rij in your self-supervised method. Because I can not find that you will change the labels during training process in experiment.py file. Do I get it wrong? Thanks!!!

xuebaliang avatar Feb 13 '20 13:02 xuebaliang

pos_mask and neg_mask response for calculating loss in self-supervised step (applied on [predicted] sim_mat)

you can print the variables during trining for sanity check.

Liang Chen [email protected] 於 2020年2月13日 週四 上午5:36寫道:

oh oh, thanks for your reply. I see the dynamic setting in experiment.py file. Then I have another question: label_mat[labels==-1, :] = -1 label_mat[:, labels==-1] = -1 label_mat[label_mat==0] = 0 label_mat[label_mat==1] = 1 pos_mask = (sim_mat > u_threshold).type(torch.cuda.FloatTensor) neg_mask = (sim_mat < l_threshold).type(torch.cuda.FloatTensor) pos_mask[label_mat==1] = 1 neg_mask[label_mat==0] = 1 pos_entropy = -torch.log(torch.clamp(sim_mat, eps, 1.0)) * pos_mask neg_entropy = -torch.log(torch.clamp(1-sim_mat, eps, 1.0)) * neg_mask loss = pos_entropy.mean() + neg_entropy.mean() + u_threshold - l_threshold

above codes seem to indicate that the cross entropy is still restricted in known true labels, but does not support from these high similar pair points. This is inconsistent with the definition of Rij in your self-supervised method. Because I can not find that you will change the labels during training process in experiment.py file. Do I get it wrong? Thanks!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thuiar/CDAC-plus/issues/2?email_source=notifications&email_token=ABKMZGZQ2YSGGIJGUVZQQGLRCVEFZA5CNFSM4KSQY6JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELU7CXA#issuecomment-585757020, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMZGYGJDIM33DQN7DGKGDRCVEFZANCNFSM4KSQY6JA .

-- 林廷恩 Ting-En (Tony) Lin, Master Department of Computer Science and Technology Tsinghua University, Beijing, China, 100084 E-mail: [email protected]

tnlin avatar Feb 13 '20 20:02 tnlin

Yes, you are right, I misunderstand these two sentences: pos_mask[label_mat==1] = 1 neg_mask[label_mat==0] = 1. Originally I think it will add extra constraint on pos_mask and neg_mask, but if you think about it carefully, it is actually complementary. Thanks for your reply.

xuebaliang avatar Feb 14 '20 01:02 xuebaliang

Hi, I find that the choice of upper threshold u and lower threshold l in dynamic process has a significant impact on clustering results. The 0.95 and 0.455 are selected by experience or after tuning the network parameter. Have you considered designing a data based selection method for them? For example, based on the similarity matrix. Looking forward to your reply, thanks!!!(Haha, I find that you are in Tsinghua University, I am in Peking University, may I have your WeChat?)

xuebaliang avatar Mar 10 '20 17:03 xuebaliang

Sure, my wechat is s950123

Liang Chen [email protected] 於 2020年3月11日 週三 上午1:40 寫道:

Hi, I find that the choice of upper threshold u and lower threshold l in dynamic process has a significant impact on clustering results. The 0.95 and 0.455 are selected by experience or after tuning the network parameter. Have you considered designing a data based selection method for them? For example, based on the similarity matrix. Looking forward to your reply, thanks!!!(Haha, I find that you are in Tsinghua University, I am in Peking University, may I have your WeChat?)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thuiar/CDAC-plus/issues/2?email_source=notifications&email_token=ABKMZG6IDPUYEXDDC63ZBATRGZ3QZA5CNFSM4KSQY6JKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOMNWAQ#issuecomment-597220098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKMZG6JWCOFEDC57GAGJYLRGZ3QZANCNFSM4KSQY6JA .

tnlin avatar Mar 10 '20 19:03 tnlin