# -*- coding: utf-8 -*-
"""Untitled35.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1fFQ2gD_1KUbFh57Mu95XBH8TUbN-ib6M
"""

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

dataset=pd.read_csv('heart.csv')
dataset=dataset.dropna(how='any')
X=dataset.iloc[:,:-1].values
y=dataset.iloc[:,-1].values

from sklearn.preprocessing import StandardScaler
sc=StandardScaler()
X[:,:1]=sc.fit_transform(X[:,:1])
X[:,3:4]=sc.fit_transform(X[:,3:4])
X[:,4:5]=sc.fit_transform(X[:,4:5])
X[:,7:8]=sc.fit_transform(X[:,7:8])

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)

from sklearn.linear_model import LogisticRegression
LOR=LogisticRegression(random_state=0)
LOR.fit(X_train,y_train)

y_pred=LOR.predict(X_test)
print(np.concatenate((y_pred.reshape(len(y_pred),1), y_test.reshape(len(y_test),1)),1))

from sklearn.metrics import confusion_matrix,accuracy_score
cm = confusion_matrix(y_test, y_pred)
print(cm)
print(accuracy_score(y_test, y_pred)*100)