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

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1e_Qcv3Ee2BpRtsqF-6mtLn1Aq9wuuR0j
"""

import pandas as pd
import numpy as np
import seaborn as sns 
import io

from google.colab import files
uploaded = files.upload()

data = pd.read_csv(io . BytesIO(uploaded['fraud_data.csv']))
data.head()

data.info()

data.tail()

fraud=data.loc[data['Class']]==1
fraud=data.loc[data['Class']]==0

fraud.count()

fraud.sum()

len(fraud)

tb=data[0:100]
print(tb)

sns.relplot(x='Amount', y='Class',data=tb)

from sklearn import linear_model
from sklearn.model_selection import train_test_split

x=data.iloc[:,:-1]
y=data['Class']

x_train, x_test, y_train, y_test = train_test_split( x, y, test_size=0.35)

clf =linear_model.LogisticRegression(C=1e5)

clf.fit(x_train, y_train)

y_pred = np.array(clf.predict(x_test))
y=np.array(y_test)

from sklearn.metrics import confusion_matrix, classification_report, accuracy_score

print(confusion_matrix(y, y_pred))

print(accuracy_score(y, y_pred))

print(classification_report(y, y_pred))

