Last active
March 20, 2017 22:19
-
-
Save grantwwoodford/c43dea734f872a9c45da8587eefec581 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 | |
def t_thread(): | |
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']) | |
# 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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment