Implement a deep neural network model that learns to expand single variable polynomials. Model input is factorized sequence and output is predicted expanded sequence.
(7-3z)(-5z-9)=15z**2-8*z-63
(7-3z)(-5*z-9) is the factorized form
15z**2-8z-63 is the expanded form
Dataset: dataset.txt
Trained model: seq2seq.h5
Dataset statistics: data_summary.ipynb
-
Proprocess the dataset and split it into train.txt, valid.txt and test.txt.(use --help for more options):
python preprocess.py --dataset_path dataset.txt --seed 2022
-
Train the Seq2Seq model on train.txt and valid.txt:
python train.py --hidden_dim 256 --batch_size 1024 --epochs 10 --learning_rate 0.005 --workers 2
-
Test the Seq2Seq model on test.txt:
python test.py --batch_size 1024 --model_path seq2seq.h5 --test_path test.txt --workers 2
Accuracy and loss on test data:
Test accuracy: 0.9859623312950134
Test loss: 0.038746245205402374
Training and Validation Accuracy curve:
Training and Validation Loss curve:
https://blog.keras.io/a-ten-minute-introduction-to-sequence-to-sequence-learning-in-keras.html