Last active
February 25, 2018 01:12
-
-
Save edwardleoni/279a7e4fae41450f15e290b4c73422d6 to your computer and use it in GitHub Desktop.
This file contains 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
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