Define your own trainer extensions in Chainer

    So how to implement custom extensions for trainer in Chainer? There are mainly 3 approaches. Define function Use decorator, @chainer.training.extension.make_extension Define class Most of the case, 1. Define function is the easiest way to quickly implement your extension.   1. Define function Just a function can be a trainer extension. Simply, define a function […]

Continue reading →

Predict code for Penn Bank Tree (ptb) dataset

  Predict code is pretty much the same with Predict code for simple sequence dataset, so I won’t explain in detail.   Code The code is on the github, predict_ptb.py.

    Given the first text by the index, args.primeindex, model will predict the following sequence as word id. The last three line converts the […]

Continue reading →

Training LSTM model with Penn Bank Tree (ptb) dataset

  This post mainly explains train_ptb.py, uploaded on github.   We have already learned RNN and LSTM network architecture, let’s apply it to PTB dataset. It is quite similar to train_simple_sequence.py explained in Training RNN with simple sequence dataset, so no much explanation is necessary.   Train code I will just paste whole the training code […]

Continue reading →

Penn Tree Bank (PTB) dataset introduction

  This post is based on the jupyter notebook ptb_dataset_introduction.ipynb uploaded on github. Penn Treebank dataset, known as PTB dataset, is widely used in machine learning of NLP (Natural Language Processing) research. Dataset if provided by the official page: Treebank-3 In Chainer, PTB dataset can be obtained with build-in function. Let’s see the dataset structure.  

[…]

Continue reading →