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

Automatically generated by Colaboratory.

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

import pandas as pd
import pickle
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split

df = pd.read_csv('creditcard.csv')
df.describe()

target_names = { 0: 'Not Fraud', 1: 'Fraud'}
df.Class.value_counts().rename(index = target_names)

x_name = df.iloc[:, 1:30].columns
y_name = df.iloc[:1, 30: ].columns

data_x = df[x_name]
data_y = df[y_name]

train_x, test_x, train_y, test_y = train_test_split(data_x, data_y, train_size=0.7, test_size=0.3)

model = LogisticRegression()
model.fit(train_x, train_y.values.ravel())

with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
print('Success!')

6c3457394b6aaa4c8fe16a497dbec3604dc9c1c4
<mask token>

<mask token>
df.describe()
<mask token>
df.Class.value_counts().rename(index=target_names)
<mask token>
model.fit(train_x, train_y.values.ravel())
with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
print('Success!')

<mask token>
df = pd.read_csv('creditcard.csv')
df.describe()
target_names = {(0): 'Not Fraud', (1): 'Fraud'}
df.Class.value_counts().rename(index=target_names)
x_name = df.iloc[:, 1:30].columns
y_name = df.iloc[:1, 30:].columns
data_x = df[x_name]
data_y = df[y_name]
train_x, test_x, train_y, test_y = train_test_split(data_x, data_y,
    train_size=0.7, test_size=0.3)
model = LogisticRegression()
model.fit(train_x, train_y.values.ravel())
with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
print('Success!')

<mask token>
import pandas as pd
import pickle
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
df = pd.read_csv('creditcard.csv')
df.describe()
target_names = {(0): 'Not Fraud', (1): 'Fraud'}
df.Class.value_counts().rename(index=target_names)
x_name = df.iloc[:, 1:30].columns
y_name = df.iloc[:1, 30:].columns
data_x = df[x_name]
data_y = df[y_name]
train_x, test_x, train_y, test_y = train_test_split(data_x, data_y,
    train_size=0.7, test_size=0.3)
model = LogisticRegression()
model.fit(train_x, train_y.values.ravel())
with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
print('Success!')

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

Automatically generated by Colaboratory.

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

import pandas as pd
import pickle
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split

df = pd.read_csv('creditcard.csv')
df.describe()

target_names = { 0: 'Not Fraud', 1: 'Fraud'}
df.Class.value_counts().rename(index = target_names)

x_name = df.iloc[:, 1:30].columns
y_name = df.iloc[:1, 30: ].columns

data_x = df[x_name]
data_y = df[y_name]

train_x, test_x, train_y, test_y = train_test_split(data_x, data_y, train_size=0.7, test_size=0.3)

model = LogisticRegression()
model.fit(train_x, train_y.values.ravel())

with open('model.pkl', 'wb') as f:
    pickle.dump(model, f)
print('Success!')
