"""

# Importing Libraries
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
"""
# Importing dataset
"""
import io
dataset = pd.read_csv('../input/framingham-heart-study-dataset/framingham.csv')
X = dataset.iloc[:,:-1].values
y = dataset.iloc[:,-1].values
"""
# Taking care of missing values
"""
from sklearn.impute import SimpleImputer
imputer = SimpleImputer(missing_values = np.nan, strategy = 'mean')
imputer.fit(X)
X = imputer.transform(X)
"""
# Splitting the dataset
"""
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_x = StandardScaler()
x_train = sc_x.fit_transform(x_train)
x_test = sc_x.transform(x_test)
"""
# Traing logistic regression model
"""
from sklearn.linear_model import LogisticRegression
lg = LogisticRegression()
lg.fit(x_train,y_train)
"""
# Predicting results of test
"""
y_pred = lg.predict(x_test)
"""
# Accuracy
"""
from sklearn.metrics import accuracy_score
print('Accuracy of my model ' ,accuracy_score(y_test,y_pred))
print("Current accuracy",accuracy_score(y_test,y_pred))
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))
"""
# Confusion matrix
"""
from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test,y_pred)
print(cm)
import seaborn as sns
sns.heatmap(pd.DataFrame(confusion_matrix(y_test,y_pred)))
plt.show()
"""
## For all predictions , the model predicted **YES** for total(2+10)->12 times, out of which 10 were actual YES (meaning the person has a risk of getting CHD).

## The model predicted **YES** for total(720+116)-836 times, out of which 720 were actual NO (meaning the person dosent have a risk of getting CHD).
"""