contrastive-predictive-coding
contrastive-predictive-coding copied to clipboard
I can reproduce the repo's result by reduce the positive samples.
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!