Last active
March 2, 2018 04:23
-
-
Save edwardleoni/917e4f80ed84534587f73b2a9b6f064f 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 | |
dataset = numpy.loadtxt("wine-data.csv", delimiter=";") | |
input = dataset[:, 0:11] | |
output = dataset[:, 11] | |
# since the data comes in a scale of 0 to 10, this is needed to we get a simple true or false | |
output = [(round(each / 10)) for each in output] | |
model = Sequential() | |
model.add(Dense(20, input_dim=11, init='uniform', activation='relu')) | |
model.add(Dense(12, init='uniform', activation='relu')) | |
model.add(Dense(4, init='uniform', activation='relu')) | |
model.add(Dense(1, init='uniform', activation='sigmoid')) | |
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) | |
model.fit(input, output, epochs=5000, batch_size=50, verbose=2) | |
model.save('wine-model.h5') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment