image_output_1.png
from sklearn.metrics import confusion_matrix

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 sn

df = pd.read_csv('/kaggle/input/creditcardfraud/creditcard.csv')

df.columns

df_missing = df.isnull().sum()
df_missing

df_desc = df.describe(include= np.number).transpose()
missing= ((df.isnull().sum())*100)/(len(df))
df_missing = pd.DataFrame(missing, columns=['missing%'])
pd.concat([df_desc,df_missing],axis=1)

#heatmap
import seaborn as sn
import matplotlib.pyplot as plt

hm=sn.heatmap(df.corr().round(3), cmap="YlGnBu")
plt.show()

from sklearn.metrics import confusion_matrix
conf_matrix = confusion_matrix(y_true=y_test, y_pred=predicted)
fig, ax = plt.subplots(figsize=(7.5, 7.5))
ax.matshow(conf_matrix, cmap=plt.cm.Blues, alpha=0.3)
for i in range(conf_matrix.shape[0]):
    for j in range(conf_matrix.shape[1]):
        ax.text(x=j, y=i, s=conf_matrix[i, j], va='center', ha='center', size='xx-large')
plt.xlabel('Predictions', fontsize=18)
plt.ylabel('Actuals', fontsize=18)
plt.title('Confusion Matrix', fontsize=18)
plt.show()