commit 1ff0de83f5aee03c770c6aed010cc0bf5bfb0888
parent d21fb16b00ec4b51acc2cffc58828521d43695f3
Author: David Freifeld <freifeld.david@gmail.com>
Date: Sat, 20 Jun 2020 10:57:57 -0700
Keras demo comment and fix
Diffstat:
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/kerasdemo.py b/kerasdemo.py
@@ -1,4 +1,14 @@
-# first neural network with keras tutorial
+#+-----------------------------------------------------------------------------+
+# Keras benchmark code to compare with network.
+#
+# Runs a fully connected feedforward neural network with backpropagation for 50
+# epochs, then tests on data. First layer has 4 neurons, 2 hidden layers have 5,
+# output layer has 1. All four layers use sigmoid for activation.
+#
+# Taken and loosely modified from:
+# https://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
+#+-----------------------------------------------------------------------------+
+
import time
# import tensorflow
from numpy import loadtxt
@@ -14,6 +24,7 @@ y = dataset[:,4]
model = Sequential()
model.add(Dense(4, input_dim=4, activation='sigmoid'))
model.add(Dense(5, activation='sigmoid'))
+model.add(Dense(5, activation='sigmoid'))
model.add(Dense(1, activation='sigmoid'))
# compile the keras model
model.compile(loss='mse', optimizer='sgd', metrics=['accuracy'])