<jupyter_start><jupyter_text>Case Study of diabetes patients using ANN<jupyter_code>#Import the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sb
#Import the dataset
data=pd.read_csv('C:/Users/aksha/Desktop/ai/datasets/diabetes.csv')
data.head()
data.shape
sb.heatmap(data.isnull())
data.groupby('Outcome').hist(figsize=(9,9))
#Countplot
sb.countplot(x='Outcome',data=data)
x=data.iloc[:,0:8].values
y=data.iloc[:,8].values

x
y
#Splitting the dataset into train and test set
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.2,random_state=0)
#Feature scaling
from sklearn.preprocessing import StandardScaler
sc=StandardScaler()
x_train=sc.fit_transform(x_train)
x_test=sc.transform(x_test)
x_test
#import the keras libraries
import keras
from keras.models import Sequential
from keras.layers import Dense
#Initialising the ANN
classifier=Sequential()
#Adding the input and first hidden layer
classifier.add(Dense(units=6,kernel_initializer='uniform',activation='relu',input_dim=8))
#Adding the second hidden layer
classifier.add(Dense(units=6,kernel_initializer='uniform',activation='relu'))
#Adding the output layer
classifier.add(Dense(units=1,kernel_initializer='uniform',activation='sigmoid'))
#Compiling the ANN
classifier.compile(optimizer='adam',loss='binary_crossentropy',metrics=['accuracy'])

#Fitting the ANN to the training set
classifier.fit(x_train,y_train,batch_size=10,epochs=100)
y_pred=classifier.predict(x_test)
y_pred=(y_pred>0.5)
#Accuracy score
from sklearn.metrics import accuracy_score
print('accuracy score:',accuracy_score(y_test,y_pred))
y_pred<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11621150493898896, 'fraction_numerical': 0.011040092969203951, 'mean_word_length': 9.830188679245284, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '84208', 'license': 'MIT', 'n_tokens_mistral': 614, 'n_tokens_neox': 596, 'n_words': 122, 'path': 'ANN2.ipynb', 'repo_name': 'ak-cell/Case-study-using-ANN-', 'size': '1721'}