From eabb7f028514da9b2e5d874428f1aed9d73044df Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 6 Jul 2021 01:44:58 +0200 Subject: [PATCH] Change model architecture to a MLP --- src/hyperparameters.py | 4 ++-- src/model.py | 21 +++++++-------------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/hyperparameters.py b/src/hyperparameters.py index 6e9704a..597929b 100644 --- a/src/hyperparameters.py +++ b/src/hyperparameters.py @@ -6,8 +6,8 @@ class Hyperparameters: train_dataset="data/train_data.tfrecords", test_dataset="data/test_data.tfrecords", eval_dataset="data/eval_data.tfrecords", - epochs=1000, - batch_size=256, + epochs=100, + batch_size=64, learning_rate=0.004, l2_rate=0.001, log_directory="logs", diff --git a/src/model.py b/src/model.py index 907fefa..30f2ff8 100644 --- a/src/model.py +++ b/src/model.py @@ -17,23 +17,16 @@ def build_model(hyperparams) -> Model: """ model = Sequential( [ - Input(shape=(None, hyperparams.max_length, len(BASES))), + Input(shape=(hyperparams.batch_size, hyperparams.max_length, len(BASES))), Masking(mask_value=-1), - Conv1D( - filters=16, - kernel_size=5, - activation="relu", - kernel_regularizer=l2(hyperparams.l2_rate), + Dense( + units=16, activation="relu", kernel_regularizer=l2(hyperparams.l2_rate) ), - MaxPool1D(pool_size=3, strides=1), - Conv1D( - filters=16, - kernel_size=3, - activation="relu", - kernel_regularizer=l2(hyperparams.l2_rate), + Dropout(rate=0.3), + Dense( + units=16, activation="relu", kernel_regularizer=l2(hyperparams.l2_rate) ), - MaxPool1D(pool_size=3, strides=1), - GlobalAveragePooling1D(), + Dropout(rate=0.3), Dense( units=16, activation="relu", kernel_regularizer=l2(hyperparams.l2_rate) ),