VisCy icon indicating copy to clipboard operation
VisCy copied to clipboard

Implement NT-Xent loss (implicit negative samples)

Open ziw-liu opened this issue 1 year ago • 2 comments

Implement InfoNCE-style (e.g. NT-Xent from SimCLR) training objective for contrastive learning. This changes sampling strategy so it probably should be done with #123.

ziw-liu avatar Aug 15 '24 20:08 ziw-liu

@ziw-liu as discussed, first implement NT-Xent loss for the "time and cell identity agnostic" sampling, which can be done with the current dataloader.

Based on the results, we can figure out our strategy for time and cell identity-aware sampling, and how to implement it properly.

Previous implementation.

mattersoflight avatar Sep 03 '24 01:09 mattersoflight

Just to log our thoughts, a 'proper' implementation would be to treat each track as a sample instead of each node as a sample in the dataset, so that each track contributes one positive pair per epoch, and no batch will contain more than 2 patches from the same track.

ziw-liu avatar Sep 03 '24 03:09 ziw-liu

@edyoshikun See also official tensorflow implementation and a pytorch reproduction.

ziw-liu avatar Nov 13 '24 00:11 ziw-liu