Fraud detection is one of the earliest industrial applications of data mining and machine learning. Fraud detection is typically handled as a binary classification problem, but the class population is unbalanced because instances of fraud are usually very rare compared to the overall volume of transactions. Moreover, when fraudulent transactions are discovered, the business typically takes measures to block the accounts from transacting to prevent further losses.
In [2]:
%matplotlib inline
import pandas as pd
import numpy as np
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn import metrics
In [3]:
import pandas as pd
url = 'https://raw.githubusercontent.com/albahnsen/PracticalMachineLearningClass/master/datasets/15_fraud_detection.csv.zip'
df = pd.read_csv(url, index_col=0)
df.head()
Out[3]:
In [5]:
df.head()
Out[5]:
In [6]:
df.shape, df.Label.sum(), df.Label.mean()
Out[6]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
Evaluate the results using Adaptive Synthetic Sampling Approach for Imbalanced Learning (ADASYN)
http://www.ele.uri.edu/faculty/he/PDFfiles/adasyn.pdf https://imbalanced-learn.readthedocs.io/en/stable/generated/imblearn.over_sampling.ADASYN.html#rf9172e970ca5-1
In [ ]:
In [ ]: