import pandas as pd
import zipfile
with zipfile.ZipFile('../datasets/fraud_detection.csv.zip', 'r') as z:
    f = z.open('15_fraud_detection.csv')
    data = pd.io.parsers.read_table(f, index_col=0, sep=',')
data.head()

X = data.drop(['Label'], axis=1)
y = data['Label']
y.value_counts(normalize=True)

"""
Explanation: Exercise 09

Fraud Detection Dataset from Microsoft Azure: data

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.
End of explanation
"""


from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.naive_bayes import GaussianNB
from sklearn.neighbbors import KNeighborsClassifier

"""
Explanation: Exercice 09.1
Estimate a Logistic Regression, GaussianNB, K-nearest neighbors and a Decision Tree Classifiers
Evaluate using the following metrics:
* Accuracy
* F1-Score
* F_Beta-Score (Beta=10)
Comment about the results
Combine the classifiers and comment
End of explanation
"""


