tund / male

MAchine LEarning (MALE)
GNU General Public License v3.0
4 stars 1 forks source link

Add Character-based RNNs on Numpy and Tensorflow #56

Open tund opened 6 years ago

tund commented 6 years ago

Character-based RNNs implemented in Numpy and Tensorflow are great models to serve as examples for many presentations on sequential data. They are also good for demonstrations and practice of "How to add a new model" tutorial.

tund commented 6 years ago

Hi @vannguyennd , as discussed, the procedure of adding the Character-RNN with Numpy implementation is as follows:

  1. Create the file char_rnn.py in male\models\deep_learning\generative
  2. Write the class CharRNN. We can follow some existing implementations such as GLM and RBM. Some important points are:
    • CharRNN inherits from Model: Class CharRNN(Model):
    • Initialize parameters in functions _init() and _init_params()
    • Iteratively train the models in function _fit_loop().
  3. Add a demo text dataset following similar steps that Tuan did. See the wiki: https://github.com/tund/male/wiki/Developer-Start-Guide
  4. Create test script by placing a file test_char_rnn.py in tests/male/models/deep_learning/generative/ Can follow test_glm.py. An example of usage:
    model = CharRNN(num_hidden=50, learning_rate=0.01)
    model.fit(X)  # X is the training data
    model.sample(num_chars=1000)

    Please have a look and estimate the datetime you can finish. If there's something unclear, you can leave comments here. Many thanks!