contrastive-predictive-coding icon indicating copy to clipboard operation
contrastive-predictive-coding copied to clipboard

I can reproduce the repo's result by reduce the positive samples.

Open 255-1 opened this issue 2 years ago • 0 comments

I try many times to repeat the result, but my binary_accuracy always 50%, it's horrible. then i find that an issue mention that the positive_sample is the half of batch_size. I know that the number of negative samples are important to make NCELoss approximate the max-likelyhood estimation.so I change the train_model function of the "train_model.py".set positive_samples=1,

train_model

train_data = SortedNumberGenerator(batch_size=batch_size, subset='train', terms=terms, positive_samples=1, predict_terms=predict_terms, image_size=image_size, color=color, rescale=True) validation_data = SortedNumberGenerator(batch_size=batch_size, subset='valid', terms=terms, positive_samples=1, predict_terms=predict_terms, image_size=image_size, color=color, rescale=True)

then I got 96% binary_accuracy at the first epoch. Yep!

255-1 avatar Mar 27 '22 07:03 255-1