Created
March 20, 2017 18:49
-
-
Save grantwwoodford/35c82d2659c2ad4415cae163153f93f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create first network with Keras | |
from keras.models import Sequential | |
from keras.layers import Dense | |
import numpy | |
import threading as t | |
import tensorflow as tf | |
# create model | |
model = Sequential() | |
model.add(Dense(12, input_dim=8, init='uniform', activation='relu')) | |
model.add(Dense(8, init='uniform', activation='relu')) | |
model.add(Dense(1, init='uniform', activation='sigmoid')) | |
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) | |
graph = tf.get_default_graph() | |
def t_thread(): | |
with graph.as_default(): | |
# evaluate the model | |
scores = model.evaluate(numpy.array([[0,0,0,0,0,0,0,0]]), numpy.array([[1]])) | |
print("%s: %.2f%%" % (model.metrics_names[1], scores[1]*100)) | |
th = t.Thread(target=t_thread) | |
th.start() | |
th.join() | |
th2 = t.Thread(target=t_thread) | |
th2.start() | |
th2.join() | |
th3 = t.Thread(target=t_thread) | |
th3.start() | |
th3.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment