import numpy
from keras.models import Sequential
from keras.layers import Dense

#loading pima indians dataset from the csv
# fix random seed for reproducibility
numpy.random.seed(7)
dataset = numpy.loadtxt(
    "./data/pima-indians-diabetes.csv", delimiter=","
)

#split into input (X) and (Y) variables

X = dataset[:,0:8]
Y = dataset[:,8]

#create model

model = Sequential()
model.add(Dense(12, input_dim=8, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='sigmoid'))

#compile model
model.compile(
    loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']
)


#fit the model
model.fit(X, Y, epochs=150, batch_size=10)
 

#evaluate the model

scores = model.evaluate(X, Y)
print(
    "\n%s: %.2f%%" % (model.metrics_names[1], scores[1]*100)
)




import numpy
from keras.models import Sequential
from keras.layers import Dense

#loading pima indians dataset from the csv
# fix random seed for reproducibility
numpy.random.seed(7)
dataset = numpy.loadtxt(
    "./data/pima-indians-diabetes.csv", delimiter=","
)

#split into input (X) and (Y) variables

X = dataset[:,0:8]
Y = dataset[:,8]

#create model

model = Sequential()
model.add(Dense(12, input_dim=8, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activation='sigmoid'))

#compile model
model.compile(
    loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']
)


#fit the model
model.fit(X, Y, epochs=150, batch_size=10)
 

#evaluate the model

scores = model.evaluate(X, Y)
print(
    "\n%s: %.2f%%" % (model.metrics_names[1], scores[1]*100)
)




#loading pima indians dataset from the csv # fix random seed for reproducibility #split into input (X) and (Y) variables #create model #compile model #fit the model #evaluate the model