All Projects → demelin → Noise-Contrastive-Estimation-NCE-for-pyTorch

demelin / Noise-Contrastive-Estimation-NCE-for-pyTorch

Licence: MIT license
Re-implementation of the Noise Contrastive Estimation algorithm for pyTorch, following "Noise-contrastive estimation: A new estimation principle for unnormalized statistical models." (Gutmann and Hyvarinen, AISTATS 2010)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Noise-Contrastive-Estimation-NCE-for-pyTorch

lmkit
language models toolkits with hierarchical softmax setting
Stars: ✭ 16 (-61.9%)
Mutual labels:  nce
NCE-loss
Tensorflow NCE loss in Keras
Stars: ✭ 30 (-28.57%)
Mutual labels:  nce
awesome-ebm
Collecting research materials on EBM/EBL (Energy Based Models, Energy Based Learning)
Stars: ✭ 143 (+240.48%)
Mutual labels:  noise-contrastive-estimation

Noise Contrastive Estimation for pyTorch

Overview

This repository contains a re-implementation of the Noise Contrastive Estimation algorithm, implemented in pyTorch. While the algorithm is fully functional, it is not very efficient.

Implementation details

As provided, the implementation assumes that its input data follows a Zipfian distribution, making it particularly suitable for training language models or word embeddings. In case the built-in (Zipfian) sampler is used to obtain the distractor items, indices representing the data classes have to be sorted in the order of descending frequency, i.e. index 0 should correspond to the most frequent word in the input data.

Acknowledgement

The provided code closely follows the TensorFlow NCE-loss implementation. As such, this project should be seen as an attempt to adopt the TF code for use within pyTorch.

Note

This re-implementation was completed with personal use in mind and is, as such, not actively maintained. You are, however, very welcome to extend or adjust it according to your own needs, should you find it useful. Happy coding :) .

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].