image_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

import seaborn as sns

data = pd.read_csv('../input/creditcard/creditcard.csv')

fraud = data[data['Class'] == 1]
normal = data[data['Class'] == 0]

f, (ax1, ax2) = plt.subplots(2, 1, sharex=True)
f.suptitle('Amount per transaction by class')
bins = 50
ax1.hist(fraud.Amount, bins = bins)
ax1.set_title('Fraud')
ax2.hist(normal.Amount, bins = bins)
ax2.set_title('Normal')
plt.xlabel('Amount ($)')
plt.ylabel('Number of Transactions')
plt.xlim((0, 20000))
plt.yscale('log')

data1 = data.sample(frac=0.1, random_state=1)
Fraud = data1[data1['Class'] == 1]
Valid = data1[data1['Class'] == 0]
state = np.random.RandomState(42)
outlier_fraction = len(Fraud) / float(len(Valid))
state = np.random.RandomState(42)

import seaborn as sns
corrmat = data1.corr()
top_corr_features = corrmat.index
plt.figure(figsize=(20, 20))
g = sns.heatmap(data[top_corr_features].corr(), annot=True, cmap='RdYlGn')