description: create simple MLP in Keras
import packages
1 | from keras.models import Sequential |
fix random seed for reproducibility
1 | numpy.random.seed(7) |
load pima indians dataset
1 | dataset = numpy.loadtxt("pima-indians-diabetes.csv", delimiter=",") |
split into input (X) and output (Y) variables
1 | X = dataset[:,0:8] |
create model
1 | model = Sequential() |
Compile model
1 | model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) |
Fit the model
1 | model.fit(X, Y, epochs=150, batch_size=10) |
evaluate the model
1 | scores = model.evaluate(X, Y) |