Classify texts with a LSTM implemented in Keras
Clone this repository:
git clone git@github.com:pinae/LSTM-Classification.git
cd LSTM-Classification
We strongly recommend to use a virtualenv:
python3 -m venv env
source env/bin/activate
Install the dependencies:
pip install wheel
pip install numpy h5py tensorflow-gpu
pip install sacred pymongo
Use tensorflow
instead of tensorflow-gpu
if you have no
GPU with CUDA.
TensorFlow supports Python only to Version 3.7 (info from march 18th). Be aware of that if your system already uses Python 3.8.
To train a LSTM type:
python train_lstm.py
The experiments use Sacred so you can change parameters on the commandline:
python train_lstm.py with embedding_vector_dimensionality=256 LSTM_dropout_factor=0.3
There are similar experiments for a fully connected network and a simple RNN:
python train_fc.py
python train_simpleRNN.py