https://github.com/titu1994/keras-indrnn
Implementation of IndRNN in Keras
https://github.com/titu1994/keras-indrnn
Last synced: 3 months ago
JSON representation
Implementation of IndRNN in Keras
- Host: GitHub
- URL: https://github.com/titu1994/keras-indrnn
- Owner: titu1994
- License: mit
- Created: 2018-03-15T18:57:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-10T15:34:30.000Z (about 5 years ago)
- Last Synced: 2025-04-04T04:41:12.733Z (6 months ago)
- Language: Python
- Size: 18 MB
- Stars: 67
- Watchers: 16
- Forks: 34
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IndRNN in Keras
Keras implementation of the IndRNN model from the paper [Independently Recurrent Neural Network (IndRNN): Building A Longer and Deeper RNN](https://arxiv.org/abs/1803.04831)# Usage
Usage of IndRNNCells
```python
from ind_rnn import IndRNNCell, RNNcells = [IndRNNCell(128), IndRNNCell(128)]
ip = Input(...)
x = RNN(cells)(ip)
...```
Usage of IndRNN layer
```python
from ind_rnn import IndRNNip = Input(...)
x = IndRNN(128)(x)```
# Notes
IndRnn and its associated cell has additional parameters, `recurrent_clip_min` and `recurrent_clip_max` which default to -1.
-1 indicates that they should take their default values of [0, 2 ^ (1 / Timesteps)] as the clipping range for **ReLU** activation. If you change the activation function, do **not** forget to change the clipping ranges as well, or the model may diverge during training.In Keras, there is implicit detection of the number of timesteps if the shape is well specified during training. Since this clipping is most important during training (for initialization of weights) and also during inference (for clipping range of the recurrent weights), it is adviseable to **always** specify the number of time steps, even during inference.
Since it may not be possible to determine the number of timesteps for variable timestep problems, the model defaults to a max clipping range of 1.0, which is equivalent to an infinite timestep problem. This may cause issues if the model was trained using a pre-set timestep.
# Libraries
- Keras 2.1.5+
- Tensorflow / Theano / CNTK (not tested)# Todo
- [x] Implement IndRNNCell and IndRNN Layer
- [x] Implement IMDB trial
- [x] Implement Addition problem trial
- [x] Implement Sequential MNIST trial
- [ ] See if MNIST converges to the paper results
- [ ] Implement Recurrent BatchNorm
- [ ] Implement Multilayer IndRNN using Residual connections