"""
# Importing Required Libraries
"""

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
from sklearn import preprocessing 
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import OrdinalEncoder
from category_encoders import *
from sklearn.preprocessing import LabelEncoder
%matplotlib inline
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn import datasets, linear_model, metrics
from sklearn.metrics import  confusion_matrix
from sklearn.preprocessing import StandardScaler
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import RandomizedSearchCV
from sklearn.metrics import accuracy_score, plot_confusion_matrix
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import LogisticRegression
    df=pd.read_csv('../input/heart-failure/heart_failure.csv')

    df.head()
#getting the names of columns
df.columns
#getting the shape of the dataset
df.shape
df.skew()
df.corr()
"""
# Exploratory Data Analysis
"""
#Global declartions of function names
global Head
global Size
global Column_names
global Describe
global Shape
global Count
global Value_count
global ISNULL
global Tail
global Ndim
global Nunique
global Memory_usage
global Duplicated
global ISNA
global DTYPES
global CORR
global Info
global operations
        

        
 def Head(value=5):
            print('\033[1m'+'displaying the', value, 'rows'+'\033[0m')
            a=df.head(value)
            return a
            print("--------------------------------------------------------------------------")
Head()
 def Tail():
    print('\033[1m'+"The last five rows of the dataframe are"+'\033[0m')
    co3=df.tail()
    return(co3)
    print("--------------------------------------------------------------------------")
Tail()
def Describe():
    print('\033[1m'+"The Description of our dataset is:"+'\033[0m')
    des=df.describe()
    return(des)
    print("--------------------------------------------------------------------------")
Describe()
def Size():
    print('\033[1m'+"The size of dataset is :"+'\033[0m')
    siz=df.size
    print(siz,'\n')
    print("--------------------------------------------------------------------------")
Size()
def Count():
    print('\033[1m'+"The count of non null values are:"+'\033[0m')
    co=df.count()
    print(co,'\n')
    print("--------------------------------------------------------------------------")
Count()
def ISNULL():
    print('\033[1m'+"Detection of missing values"+'\033[0m')
    co2=df.isnull().sum()
    print(co2,'\n')
    print("--------------------------------------------------------------------------")
ISNULL()
def Ndim():
    print('\033[1m'+"The dimensions of data set are:"+'\033[0m')
    co4=df.ndim
    print(co4,'\n')
    print("--------------------------------------------------------------------------")
Ndim()
def Nunique():
    print('\033[1m'+"Total number of unique values are:"+'\033[0m')
    co5=df.nunique()
    print(co5,'\n')
    print("--------------------------------------------------------------------------")
Nunique()
def Memory_usage():
    print('\033[1m'+"The total memory used is :"+'\033[0m')
    co6=df.memory_usage()
    print(co6,'\n')
    print("--------------------------------------------------------------------------")
Memory_usage()
def Duplicated():
    print('\033[1m'+"Total number of duplicate rows"+'\033[0m')
    co7=df.duplicated().count()
    return(co7)
    print("--------------------------------------------------------------------------")
Duplicated()
def DTYPES():
    print('\033[1m'+"The datatypes are :"+'\033[0m')
    co9=df.dtypes
    print(co9,'\n')
    print("--------------------------------------------------------------------------")
DTYPES()
def Info():
    print('\033[1m'+"The info of data set is :"+'\033[0m')
    co11=df.info()
    print("--------------------------------------------------------------------------")
Info()
def operations(df,x):
    if df[x].dtype=="float64":
        print('\033[1m'+'', x, 'rows'+'\033[0m')
        print('\033[1m'+"It is a quantitaive data \n"+'\033[0m')
        print("The mean is :\n",df[x].mean())
        print("The median is :\n",df[x].median())
        print("The Standard Deviation is \n",df[x].std())
        q1=df[x].quantile(0.25)
        q2=df[x].quantile(0.5)
        q3=df[x].quantile(0.75)
        IQR=q3-q1
        LLP=q1-1.5*IQR
        ULP=q3+1.5*IQR
        print("The quartiles are q1 : \n",q1)
        print("The quartiles are q2 : \n",q2)
        print("The quartiles are q3 :\n ",q3)
        print("The Uppler limit point of the data is \n",ULP)
        print("The lower limit point of the data is \n ",LLP)
        if df[x].min()>LLP and df[x].max()<ULP:
            print("The outliers are not present \n")
            print("--------------------------------------------------------------------------")

        else:

            print("The outliers are present \n")
            print("The outliers are :")
            print(df[df[x].values>ULP][x])
            print(df[df[x].values<LLP][x])

            print("--------------------------------------------------------------------------")


    elif df[x].dtype=="int64":
        print('\033[1m'+'', x, 'rows'+'\033[0m')
        print('\033[1m'+"It is a quantitaive data \n"+'\033[0m')
        print("The mean is : \n",df[x].mean())
        print("The median is : \n",df[x].median())
        print("The Standard Deviation is \n",df[x].std())
        q1=df[x].quantile(0.25)
        q2=df[x].quantile(0.5)
        q3=df[x].quantile(0.75)
        IQR=q3-q1
        LLP=q1-1.5*IQR
        ULP=q3+1.5*IQR
        print("The quartiles are q1 : \n",q1)
        print("The quartiles are q2 : \n",q2)
        print("The quartiles are q3 : \n",q3)
        print("The Uppler limit point of the data is \n",ULP)
        print("The lower limit point of the data is \n",LLP)
        if df[x].min()>LLP and df[x].max()<ULP:
            print("The outliers are not present \n")

            print("--------------------------------------------------------------------------")

        else:

            print("The outliers are present \n")
            print("The outliers are :")
            print(df[df[x].values>ULP][x])
            print(df[df[x].values<LLP][x])
            print("--------------------------------------------------------------------------")







    else:

        print('\033[1m'+"The data is Qualitative \n"+'\033[0m')


        if df[x].nunique()==1:
            print('\033[1m'+"The data is singular \n"+'\033[0m')
            print("The mode is :",df[x].mode())
            print("The count of mode is \n",df[x].value_counts())
        elif df[x].nunique()==2:
            print('\033[1m'+"The data is Binary \n"+'\033[0m')
            print("The mode is :",df[x].mode())
            print("The count of mode is \n",df[x].value_counts())
        elif df[x].nunique()>2:
            print('\033[1m'+"The data is Multi \n"+'\033[0m')
            print("The mode is :",df[x].mode())
            print("The count of mode is \n",df[x].value_counts())

        print("--------------------------------------------------------------------------")

c=df.columns
for i in c:
    operations(df,i)
    print("\n")



"""
# Summary of EDA
"""
def Summary():
        print('\033[1m'+"The Summary of data is  \n"+'\033[0m')
        print("The shape of the datset is :",df.shape)
        print("The sixe o the data set is :",df.size)
        print("The dimensions of the dataset are:",df.ndim)
        print("The memory usage of the data set are",df.memory_usage())
        print("The data types of the dataset are:",df.dtypes)
        print("--------------------------------------------------------------------------")

Summary()     
 def Column_Summary():
        print('\033[1m'+"The Column wise Summary of data is  \n"+'\033[0m')
        k=df.columns
        for i in k:
            print('\033[1m'+'', i, 'rows'+'\033[0m')
            print("The Shape of the column ",i,"is ",df[i].shape)
            print("The Size of the column ",i,"is ",df[i].size)
            print("The Dimensions of the column ",i,"is ",df[i].ndim)
            print("The Memory used by the column ",i,"is ",df[i].memory_usage())
            print("The Data types  of the column ",i,"is ",df[i].dtypes)
            print("--------------------------------------------------------------------------")
Column_Summary()
"""
# Querying the Data
"""
df
df['age'].min()
df['age'].max()
df['age'].values
list1=df[['age','anaemia']]
list1[(list1['anaemia'] > 0) & (list1['age'] > 40) & (list1['age'] <= 50)]['age']
list1[(list1['anaemia'] > 0) & (list1['age'] > 50) & (list1['age'] <= 60)]['age']
list1[(list1['anaemia'] > 0) & (list1['age'] > 60) & (list1['age'] <= 70)]['age']
len(list1[(list1['anaemia'] > 0) & (list1['age'] > 70) & (list1['age'] <= 80)]['age'])
len(list1[(list1['anaemia'] > 0) & (list1['age'] > 80) & (list1['age'] <= 90)]['age'])
len(list1[(list1['anaemia'] > 0) & (list1['age'] > 90) & (list1['age'] <= 100)]['age'])
list2=df[['age','creatinine_phosphokinase']]
(list2[ (list2['age']>40 ) & (list2['age']<=50)]['creatinine_phosphokinase']).mean()
(list2[ (list2['age']>50 ) & (list2['age']<=60)]['creatinine_phosphokinase']).mean()
(list2[ (list2['age']>60 ) & (list2['age']<=70)]['creatinine_phosphokinase']).mean()
(list2[ (list2['age']>70 ) & (list2['age']<=80)]['creatinine_phosphokinase']).mean()
(list2[ (list2['age']>80 ) & (list2['age']<=90)]['creatinine_phosphokinase']).mean()
(list2[ (list2['age']>90 ) & (list2['age']<=100)]['creatinine_phosphokinase']).mean()
list3=df[['age','diabetes']]
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 40) & (list3['age'] <= 50)]['age'])
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 50) & (list3['age'] <= 60)]['age'])
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 60) & (list3['age'] <= 70)]['age'])
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 70) & (list3['age'] <= 80)]['age'])
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 80) & (list3['age'] <= 90)]['age'])
len(list3[(list3['diabetes'] > 0) & (list3['age'] > 90) & (list3['age'] <= 100)]['age'])
list4=df[['age','ejection_fraction']]
(list4[ (list4['age']>40 ) & (list4['age']<=50)]['ejection_fraction']).mean()
(list4[ (list4['age']>40 ) & (list4['age']<=50)]['ejection_fraction']).mean()
(list4[ (list4['age']>50 ) & (list4['age']<=60)]['ejection_fraction']).mean()
(list4[ (list4['age']>60 ) & (list4['age']<=70)]['ejection_fraction']).mean()
(list4[ (list4['age']>70 ) & (list4['age']<=80)]['ejection_fraction']).mean()
(list4[ (list4['age']>80 ) & (list4['age']<=90)]['ejection_fraction']).mean()
(list4[ (list4['age']>90 ) & (list4['age']<=100)]['ejection_fraction']).mean()
list5=df[['age','high_blood_pressure']]
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 40) & (list5['age'] <= 50)]['age'])
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 50) & (list5['age'] <= 60)]['age'])
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 60) & (list5['age'] <= 70)]['age'])
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 70) & (list5['age'] <= 80)]['age'])
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 80) & (list5['age'] <= 90)]['age'])
len(list5[(list5['high_blood_pressure'] > 0) & (list5['age'] > 90) & (list5['age'] <= 100)]['age'])
list6=df[['age','platelets']]
(list6[ (list6['age']>40 ) & (list6['age']<=50)]['platelets']).mean()
(list6[ (list6['age']>50 ) & (list6['age']<=60)]['platelets']).mean()
(list6[ (list6['age']>60 ) & (list6['age']<=70)]['platelets']).mean()
(list6[ (list6['age']>70 ) & (list6['age']<=80)]['platelets']).mean()
(list6[ (list6['age']>80 ) & (list6['age']<=90)]['platelets']).mean()
(list6[ (list6['age']>90 ) & (list6['age']<=100)]['platelets']).mean()
list7=df[['age','serum_creatinine']]
(list7[ (list7['age']>40 ) & (list7['age']<=50)]['serum_creatinine']).mean()
(list7[ (list7['age']>50 ) & (list7['age']<=60)]['serum_creatinine']).mean()
(list7[ (list7['age']>60 ) & (list7['age']<=70)]['serum_creatinine']).mean()
(list7[ (list7['age']>70 ) & (list7['age']<=80)]['serum_creatinine']).mean()
(list7[ (list7['age']>80 ) & (list7['age']<=90)]['serum_creatinine']).mean()
(list7[ (list7['age']>90 ) & (list7['age']<=100)]['serum_creatinine']).mean()
list8=df[['age','serum_sodium']]
(list8[ (list8['age']>40 ) & (list8['age']<=50)]['serum_sodium']).mean()
(list8[ (list8['age']>50 ) & (list8['age']<=60)]['serum_sodium']).mean()
(list8[ (list8['age']>60 ) & (list8['age']<=70)]['serum_sodium']).mean()
(list8[ (list8['age']>70 ) & (list8['age']<=80)]['serum_sodium']).mean()
(list8[ (list8['age']>80 ) & (list8['age']<=90)]['serum_sodium']).mean()
(list8[ (list8['age']>90 ) & (list8['age']<=100)]['serum_sodium']).mean()
list9=df[['age','sex']]
len(list9[(list9['sex'] > 0) & (list9['age'] > 40) & (list9['age'] <= 50)]['age'])
len(list9[(list9['sex'] > 0) & (list9['age'] > 50) & (list9['age'] <= 60)]['age'])
len(list9[(list9['sex'] > 0) & (list9['age'] > 60) & (list9['age'] <= 70)]['age'])
len(list9[(list9['sex'] > 0) & (list9['age'] > 70) & (list9['age'] <= 80)]['age'])
len(list9[(list9['sex'] > 0) & (list9['age'] > 80) & (list9['age'] <= 90)]['age'])
len(list9[(list9['sex'] > 0) & (list9['age'] > 90) & (list9['age'] <= 100)]['age'])
list10=df[['age','sex']]
len(list10[(list10['sex'] == 0) & (list10['age'] > 40) & (list10['age'] <= 50)]['age'])
len(list10[(list10['sex'] == 0) & (list10['age'] > 50) & (list10['age'] <= 60)]['age'])
len(list10[(list10['sex'] == 0) & (list10['age'] > 60) & (list10['age'] <= 70)]['age'])
len(list10[(list10['sex'] == 0) & (list10['age'] > 70) & (list10['age'] <= 80)]['age'])
len(list10[(list10['sex'] == 0) & (list10['age'] > 80) & (list10['age'] <= 90)]['age'])
len(list10[(list10['sex'] == 0) & (list10['age'] > 90) & (list10['age'] <= 100)]['age'])
list11=df[['age','smoking','sex']]
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 40) & (list11['age'] <= 50)]['age'])
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 50) & (list11['age'] <= 60)]['age'])
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 60) & (list11['age'] <= 70)]['age'])
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 70) & (list11['age'] <= 80)]['age'])
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 80) & (list11['age'] <= 90)]['age'])
len(list11[(list11['sex'] >0)& (list11['smoking'] >0) & (list11['age'] > 90) & (list11['age'] <= 100)]['age'])
list12=list11=df[['age','smoking','sex']]
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 40) & (list12['age'] <= 50)]['age'])
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 50) & (list12['age'] <= 60)]['age'])
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 60) & (list12['age'] <= 70)]['age'])
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 70) & (list12['age'] <= 80)]['age'])
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 80) & (list12['age'] <= 90)]['age'])
len(list12[(list12['sex'] ==0)& (list12['smoking'] ==0) & (list12['age'] > 90) & (list12['age'] <= 100)]['age'])
list13=df[['age','time']]
(list13[ (list13['age']>40 ) & (list13['age']<=50)]['time']).mean()
(list13[ (list13['age']>50 ) & (list13['age']<=60)]['time']).mean()
(list13[ (list13['age']>60 ) & (list13['age']<=70)]['time']).mean()
(list13[ (list13['age']>70 ) & (list13['age']<=80)]['time']).mean()
(list13[ (list13['age']>80 ) & (list13['age']<=90)]['time']).mean()
(list13[ (list13['age']>90 ) & (list13['age']<=100)]['time']).mean()
list14=df[['age','sex','DEATH_EVENT']]
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 40) & (list14['age'] <= 50)]['age'])
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 50) & (list14['age'] <= 60)]['age'])
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 60) & (list14['age'] <= 70)]['age'])
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 70) & (list14['age'] <= 80)]['age'])
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 80) & (list14['age'] <= 90)]['age'])
len(list14[(list14['sex'] > 0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 90) & (list14['age'] <= 100)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 40) & (list14['age'] <= 50)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 50) & (list14['age'] <= 60)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 60) & (list14['age'] <= 70)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 70) & (list14['age'] <= 80)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 80) & (list14['age'] <= 90)]['age'])
len(list14[(list14['sex']==0) & (list14['DEATH_EVENT'] > 0) & (list14['age'] > 90) & (list14['age'] <= 100)]['age'])
list15=df[['age','diabetes','sex']]
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 40) & (list15['age'] <= 50)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 50) & (list15['age'] <= 60)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 60) & (list15['age'] <= 70)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 70) & (list15['age'] <= 80)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 80) & (list15['age'] <= 90)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 90) & (list15['age'] <= 100)]['age'])
len(list15[(list15['sex']>0) & (list15['diabetes'] > 0) & (list15['age'] > 90) & (list15['age'] <= 100)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 40) & (list15['age'] <= 50)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 50) & (list15['age'] <= 60)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 60) & (list15['age'] <= 70)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 70) & (list15['age'] <= 80)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 80) & (list15['age'] <= 90)]['age'])
len(list15[(list15['sex']==0) & (list15['diabetes'] > 0) & (list15['age'] > 90) & (list15['age'] <= 100)]['age'])
df2={'age_group:':['40-50','50-60','60-70','70-80','80-90','90-100'],'count_anemia':[67,88,85,34,15,3],'creatinine_phosphokinase_avg':[758.32,672.22,381.55,411.29,951.8,355],'diabetes':[31,40,39,9,3,1],'diabetes_male':[13,22,24,6,2,1],'diabetes_female':[18,18,15,3,1,0],'ejection_fraction_avg':[36.43,38.39,39.22,35.67,43.8,36],'high_blood_pressure':[23,25,33,19,2,2],'platelets_avg':[277106.68,261369.38,251681.060,266052.65,265423.86,306786.01],'serum_creatinine_avg':[1.12,1.56,1.26,1.83,1.46,1.61],'serum_sodium_avg':[136.17,137.03,136.82,136.23,135.86,134.66],'Males':[38,60,51,27,11,2],'Females':[29,28,34,7,4,1],'smoke_male':[17,30,27,11,5,0],'smoke_female':[28,27,33,6,4,1],'time_avg':[137.31,133.85,134.36,114.35,78,33.66],'Male_Death':[10,14,14,14,8,2],'Female_Death':[9,11,7,4,2,1]}
new = pd.DataFrame.from_dict(df2)
"""
# Relational Observation of Data Frame
"""
new
"""
# Data Visualization
"""
"""
# # Distribution Plots
"""
for i in df.columns:
    sns.distplot(df[i])
    plt.show()
    

"""
# Relation Plots
"""
plt.figure(figsize=(10,16))
ax = sns.heatmap(df.corr(),annot = True, cmap = 'viridis')
plt.show()

new.columns
df3=new.drop('age_group:',axis=1)
df3
for i in df3.columns:
    x=new['age_group:']
    y=df3[i]
    sns.barplot(x,y)
    plt.show()
import plotly.graph_objects as go
colors = ['gold', 'mediumturquoise', 'darkorange', 'lightgreen','red','green']
for i in df3.columns:

    fig = go.Figure(data=[go.Pie(labels=new['age_group:'],
                                 values=df3[i])])
    fig.update_traces(hoverinfo='label+percent', textinfo='value', textfont_size=20,
                      marker=dict(colors=colors, line=dict(color='#000000', width=2)))
    print('\033[1m'+i+'\033[0m')
    fig.show()
for i in df.columns:
    sns.boxplot(df[i])
    plt.show()
sns.pairplot(df)
plt.show()
"""
# Data Modelling and Feature Extraction  
"""
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaler.fit(df.drop(['DEATH_EVENT'],axis = 1))
feature=df
feature=feature.drop('DEATH_EVENT',axis=1)
label=df['DEATH_EVENT']
X_train,X_test,y_train,y_test=train_test_split(feature,label,test_size=.3)
print(X_train.shape,y_train.shape)
print(X_test.shape,y_test.shape)
from sklearn.metrics import classification_report, confusion_matrix
logreg = LogisticRegression()
logreg.fit(X_train, y_train)
y_pred = logreg.predict(X_test)
print('Accuracy of logistic regression classifier on test set: {:.2f}'.format(logreg.score(X_test, y_test)))
confusion_matrix = confusion_matrix(y_test, y_pred)
print(confusion_matrix)