text_plain_output_1.png
from sklearn.feature_selection import SelectKBest, chi2

import csv

import matplotlib.pyplot as plt

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

path = '/kaggle/input/pima-indians-diabetes-database/diabetes.csv'
raw = open(path, 'rt', encoding='utf8')
reader = csv.reader(raw, delimiter=',')
header = next(reader)
data = list(reader)
data = np.array(data).astype('float')

raw = open(path, 'rt', encoding='utf8')
header = raw.readline()
data = np.loadtxt(raw, delimiter=',')

dataset = pd.read_csv(path)
dataset.shape

dataset.dtypes

dataset.corr()

dataset.skew()

import matplotlib.pyplot as plt

import seaborn as sns
corr = dataset.corr()

X = dataset.drop('Outcome', axis=1).values
y = dataset['Outcome'].values

from sklearn.feature_selection import SelectKBest, chi2
names = dataset.columns[:-1]
skb = SelectKBest(score_func=chi2, k=5)
skb.fit(X, y)
argsort = np.argsort(skb.scores_)[::-1]
print(skb.scores_)
print(names[argsort][:5])