import pandas
from keras.models import Sequential
from keras.layers.core import Dense, Activation

# load dataset
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np

# Read the data from dataset
dataset = pd.read_csv("diabetes.csv", header=None).values

# Training the dataset
X_train, X_test, Y_train, Y_test = train_test_split(dataset[:,0:8], dataset[:,8],test_size=0.25, random_state=87)


# Create model
my_first_nn = Sequential()

# Input layer
my_first_nn.add(Dense(20, input_dim=8, activation='relu'))

# Hidden Layers
my_first_nn.add(Dense(15, activation='relu'))
my_first_nn.add(Dense(30, activation='relu'))
my_first_nn.add(Dense(25, activation='relu'))

# Output Layer
my_first_nn.add(Dense(1, activation='sigmoid'))

# Compile the model
my_first_nn.compile(loss='binary_crossentropy', optimizer='adam', metrics=['acc'])

# Training the Model
my_first_nn_fitted = my_first_nn.fit(X_train, Y_train, epochs=100, initial_epoch=0)

# Model Summary
print(my_first_nn.summary())

# Evaluating the Model
score = my_first_nn.evaluate(X_test, Y_test)
print("Loss ", score[0] * 100)
print("Accuracy ", score[1] * 100)

