aboutsummaryrefslogtreecommitdiffstats
path: root/dlstuff/two.py
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-10-20 11:56:59 +0000
committerbloodstalker <thabogre@gmail.com>2018-10-20 11:56:59 +0000
commit4d3d0e8a9c366c42c44bc21f78610d2ebb019b77 (patch)
treed3a115f6667ab192fff2d4bc15b51099df4dcb8a /dlstuff/two.py
parentupdate (diff)
downloadseer-4d3d0e8a9c366c42c44bc21f78610d2ebb019b77.tar.gz
seer-4d3d0e8a9c366c42c44bc21f78610d2ebb019b77.zip
update
Diffstat (limited to '')
-rwxr-xr-xdlstuff/two.py9
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)