text_plain_output_1.png
from sklearn.linear_model import LogisticRegression

from sklearn.model_selection import cross_val_score

from sklearn.preprocessing import LabelEncoder

from sklearn.preprocessing import MinMaxScaler

import matplotlib.pyplot as plt

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

dataset = pd.read_csv('../input/financial-dataset-for-fraud-detection-in-a-comapny/Fraud.csv')

dataset.shape

dataset.nunique().sort_values(ascending=True)

target = 'isFraud'
features = [feature for feature in dataset.columns if feature not in [target]]

dataset.isna().sum()

pd.set_option('display.float_format', '{:.2f}'.format)

from sklearn.preprocessing import LabelEncoder
encoder = {}
for i in dataset.select_dtypes('object').columns:
    encoder[i] = LabelEncoder()
    dataset[i] = encoder[i].fit_transform(dataset[i])

x = dataset.drop(columns=['isFraud'])
y = dataset['isFraud']

y.value_counts()

y.value_counts()

from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
x = scaler.fit_transform(x)

log_reg = LogisticRegression()
log_reg.fit(x_train, y_train)

y_pred = log_reg.predict(x_test)

cvs = cross_val_score(log_reg, x, y, cv=3)

cvs.mean()