Official implementation and experimental results (excluding grid searches) for volume preserving recurrent neural networks (VPRNN) in keras with tensorflow 1.x backend.
This repository depends on the keras-vpnn
package. Install that with
pip install git+http://github.com/wtaylor17/keras-vpnn
The remaining dependencies (of the python package) are:
wget
tensorflow
1.x, tested with1.15.2
keras
version2.3.1
numpy
Additionally for some scripts, you may need matplotlib
, seaborn
, tqdm
, or some other utilities.
Some scripts import keras_layer_normalization
(see here)
but the experiments reported don't actually use it.
Run
pip install .
from the root directory of this repository, or alternatively
pip install git+http://github.com/wtaylor17/VPRNN
from anywhere with an internet connection.
- Addition problem
T=500,1000,5000,10000
- Sequential MNIST classification
- Permuted MNIST classification
- IMDB movie review classification
- HAR-2 human activity classification
For each experiment (other than the addition problem), 5 training runs with the best hyperparameters were done after a grid search based on validation performance. The logs and models for the first of each of these 5 runs is provided.
Single layer accuracies and parameters (IMDB excludes embeddings):
Data Set | Test Accuracy (%) | Approx. Parameters |
---|---|---|
MNIST | 98.12 | 11k |
pMNIST | 96.01 | 11k |
IMDB | 87.74 | 56k |
HAR-2 | 94.94 | 5k |
If you get AttributeError: 'str' object has no attribute 'decode'
when loading a VPRNN, try pip install h5py==2.10.0 --force-reinstall
.
The pretrained model can't be easily loaded by default. Assuming embeddings are stashed, add the code
from vprnn.imdb_data import create_embeddings_matrix
class IMDBInit(keras.initializers.Initializer):
def __init__(self, **kwargs):
self.mat, *_ = create_embeddings_matrix()
self.mat = K.constant(self.mat)
def __call__(self, *args, **kwargs):
return self.mat
setattr(keras.initializers, '<lambda>', IMDBInit)
before you call load_vprnn
. An evaluation script may be added soon. For now, see this Colab notebook.
There was an issue with HAR data on linux that is now fixed. See this Colab notebook.