This tutorial shows how to use nce-loss to speed up multi-class classification when the number of classes is huge.
You can get the source code for this example on GitHub.
- toy_softmax.py. A multi class example using softmax output
- toy_nce.py. A multi-class example using nce loss
- word2vec.py. A CBOW word2vec example using nce loss
Run word2vec.py with the following command:
./get_text8.sh python word2vec.py
- lstm_word.py. An LSTM example using nce loss
Run lstm_word.py with the following command:
./get_text8.sh python lstm_word.py