diff --git a/src/model.py b/src/model.py index 94ee44a..3252c1e 100644 --- a/src/model.py +++ b/src/model.py @@ -15,39 +15,44 @@ def build_model() -> Model: """ Build the CNN model """ - model = Sequential( - [ - layers.Conv1D( - filters=16, - kernel_size=5, - activation="relu", - kernel_regularizer=l2(L2), - ), - layers.MaxPool1D(pool_size=3, strides=1), - layers.Conv1D( - filters=16, - kernel_size=3, - activation="relu", - kernel_regularizer=l2(L2), - ), - layers.MaxPool1D(pool_size=3, strides=1), - layers.Flatten(), - layers.Dense( - units=16, - activation="relu", - kernel_regularizer=l2(L2), - ), - layers.Dropout(rate=0.3), - layers.Dense( - units=16, - activation="relu", - kernel_regularizer=l2(L2), - ), - layers.Dropout(rate=0.3), - # FIXME Change output size - layers.Dense(units=len(BASES), activation="softmax"), - ] + model = Sequential() + model.add( + layers.Conv1D( + filters=16, + kernel_size=5, + activation="relu", + kernel_regularizer=l2(L2), + ) ) + model.add(layers.MaxPool1D(pool_size=3, strides=1)) + model.add( + layers.Conv1D( + filters=16, + kernel_size=3, + activation="relu", + kernel_regularizer=l2(L2), + ) + ) + model.add(layers.MaxPool1D(pool_size=3, strides=1)) + model.add(layers.Flatten()) + model.add( + layers.Dense( + units=16, + activation="relu", + kernel_regularizer=l2(L2), + ) + ) + model.add(layers.Dropout(rate=0.3)) + model.add( + layers.Dense( + units=16, + activation="relu", + kernel_regularizer=l2(L2), + ) + ) + model.add(layers.Dropout(rate=0.3)) + # FIXME Change output size + model.add(layers.Dense(units=len(BASES), activation="softmax")) model.compile( optimizer=Adam(LEARNING_RATE), loss=sparse_categorical_crossentropy,