text_plain_output_1.png
from sklearn import metrics

from sklearn.linear_model import LogisticRegression

from sklearn.metrics import classification_report, confusion_matrix

import matplotlib.pyplot as plt

import pandas as pd

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

data = pd.read_csv('../input/diabetes-dataset/diabetes.csv')
data

X = pd.DataFrame(data, columns=['Pregnancies', 'Glucose', 'BloodPressure', 'Skinthickness', 'Insulin', 'BMI', 'DiabetesPedigreeFunction', 'Age'])
y = data.Outcome
X

logreg = LogisticRegression(solver='liblinear')
logreg.fit(X_train, y_train)
y_pred = logreg.predict(X_test)

fpr, tpr, _ = metrics.roc_curve(y_test, y_pred)

y_pred_proba = logreg.predict_proba(X_test)[:, 1]
fpr, tpr, _ = metrics.roc_curve(y_test, y_pred_proba)

from sklearn.metrics import classification_report, confusion_matrix
logreg.classes_

logreg.intercept_

logreg.coef_

logreg.predict_proba(X)

logreg.predict(X)

logreg.score(X, y)

confusion_matrix(y, logreg.predict(X))

cm = confusion_matrix (y , logreg.predict(X))

fig,ax = plt.subplots(figsize= (8,8))
ax.imshow(cm)
ax.grid(False)
ax.xaxis.set(ticks=(0,1), ticklabels=('Predicted 0s', 'Predicted 1s'))
ax.yaxis.set(ticks=(0,1), ticklabels=('Predicted 0s', 'Predicted 1s'))
ax.set_ylim(1.5, -0.5)
for i in range(2):
    for j in range(2):
        ax.text(j,i, cm[i,j], ha='center', va='center', color ='red')
plt.show()  

print(classification_report(y, logreg.predict(X)))