<jupyter_start><jupyter_text>PROTOTYPE<jupyter_code>import pandas as pd
data = pd.read_csv('/content/diabetes.csv')
# data.head(5)
diab = data.copy()
target = 'CLASS'
features_list = list(diab.columns)
features_list.remove(target)
df_first_3 = data.head(100)
df_first_3
diab[:].hist(bins=40, edgecolor='b', linewidth=1.0,
                          xlabelsize=8, ylabelsize=8, grid=False, 
                          figsize=(16,6), color='red')    
plt.tight_layout(rect=(0, 0, 1.2, 1.2))   
plt.suptitle('diab', x=0.65, y=1.25, fontsize=14);
# gapminder = pd.read_csv('http://bit.ly/2cLzoxH')
df1 = data[['HbA1c', 'BMI','CLASS']]
heatmap1_data = pd.pivot_table(df1, values='CLASS', index=['HbA1c'], columns='BMI')
sns.heatmap(heatmap1_data, cmap="magma")
import numpy as np
import pylab
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import tensorflow as tf
from sklearn import datasets
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.manifold import TSNE
from sklearn.datasets import load_digits
from scipy.stats import norm
import time
import keras
from keras.layers import Conv2D, Conv2DTranspose, Input, Flatten, Dense, Lambda, Reshape
from keras.layers import BatchNormalization
from keras.models import Model
from keras.datasets import mnist
from keras.losses import binary_crossentropy
from keras import backend as K
data_X=diab[features_list]
data_y=diab['CLASS']
tsne = TSNE(n_components=2, random_state=0)
tsne_obj= tsne.fit_transform(data_X)
tsne_df = pd.DataFrame({'X':tsne_obj[:,0],
                        'Y':tsne_obj[:,1],
                        'digit':data_y})

sns.scatterplot(x="X", y="Y",
              hue="digit",
              palette=['green','red','blue'],  
              legend='brief',
              data=tsne_df);
x = data.iloc[:, [0,1,2,3,4,5,6,7,8,9,10]].values
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt

kmeans = KMeans(n_clusters = 3, init = 'k-means++', max_iter = 300, n_init = 10, random_state = 0)
y_kmeans = kmeans.fit_predict(x)
x
ans=0
# int(data.iloc[:, [11]].values[0]),y_kmeans[0]
for i in range(len(x)):
  if int(data.iloc[:, [11]].values[i])==y_kmeans[i]:
    ans+=1
ans/len(x)
x,y_kmeans
x[0,0]
x[y_kmeans == 0, 0]
x[y_kmeans == 0, 1]
plt.scatter(x[y_kmeans == 0, 0], x[y_kmeans == 0, 1], s = 100, c = 'green', label = 'NO D')
plt.scatter(x[y_kmeans == 1, 0], x[y_kmeans == 1, 1], s = 100, c = 'red', label = 'D')
plt.scatter(x[y_kmeans == 2, 0], x[y_kmeans == 2, 1], s = 100, c = 'orange', label = 'P D')

#Plotting the centroids of the clusters
# plt.scatter(kmeans.cluster_centers_[:, 0], kmeans.cluster_centers_[:,1], s = 100, c = 'blue', label = 'Centroids')

plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15911562160202972, 'fraction_numerical': 0.03660746647335991, 'mean_word_length': 4.338491295938105, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '183531', 'license': 'MIT', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1084, 'n_words': 243, 'path': '2feature_clustering.ipynb', 'repo_name': 'HetNaik/Prerequisites_for_ExplainableArtificialIntelligence', 'size': '2759'}