Skip to content

Instantly share code, notes, and snippets.

@edwardleoni
Last active February 25, 2018 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edwardleoni/279a7e4fae41450f15e290b4c73422d6 to your computer and use it in GitHub Desktop.
Save edwardleoni/279a7e4fae41450f15e290b4c73422d6 to your computer and use it in GitHub Desktop.
from keras.models import Sequential
from keras.layers import Dense
import numpy
# load dataset
dataset = numpy.loadtxt("diabetes.csv", delimiter=",")
# split into input and ouput
input = dataset[:,0:8]
output = dataset[:,8]
# create model & add layers
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'))
# compile model
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# train the model
model.fit(input, output, epochs=600, batch_size=10, verbose=2)
model.save('diabetes.h5')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment