diff options
author | bloodstalker <thabogre@gmail.com> | 2018-10-20 11:56:59 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-10-20 11:56:59 +0000 |
commit | 4d3d0e8a9c366c42c44bc21f78610d2ebb019b77 (patch) | |
tree | d3a115f6667ab192fff2d4bc15b51099df4dcb8a /dlstuff/two.py | |
parent | update (diff) | |
download | seer-4d3d0e8a9c366c42c44bc21f78610d2ebb019b77.tar.gz seer-4d3d0e8a9c366c42c44bc21f78610d2ebb019b77.zip |
update
Diffstat (limited to '')
-rwxr-xr-x | dlstuff/two.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/dlstuff/two.py b/dlstuff/two.py index 9eab134..8287708 100755 --- a/dlstuff/two.py +++ b/dlstuff/two.py @@ -10,6 +10,7 @@ from keras.datasets import imdb import numpy as np from keras import models from keras import layers +from keras import regularizers import matplotlib.pyplot as plt def SigHandler_SIGINT(signum, frame): @@ -67,8 +68,10 @@ def premain(argparser): y_test = np.asarray(test_labels).astype("float32") model = models.Sequential() - model.add(layers.Dense(16, activation="relu", input_shape=(10000,))) - model.add(layers.Dense(16, activation="relu")) + model.add(layers.Dense(16, kernel_regularizer=regularizers.l2(0.001), activation="relu", input_shape=(10000,))) + model.add(layers.Dropout(0.5)) + model.add(layers.Dense(16, kernel_regularizer=regularizers.l2(0.001), activation="relu")) + model.add(layers.Dropout(0.5)) model.add(layers.Dense(1, activation="sigmoid")) x_val = x_train[:10000] @@ -85,7 +88,7 @@ def premain(argparser): plot_acc(history) ''' - model.fit(x_train, y_train, epochs=4, batch_size=512) + model.fit(x_train, y_train, epochs=20, batch_size=512) results = model.evaluate(x_test, y_test) print(results) |