Coder Social home page Coder Social logo

sankarsmith / credit-card-fraud-detection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from manashpratim/credit-card-fraud-detection

0.0 0.0 0.0 85.29 MB

Identify fraudulent credit card transactions.

License: Apache License 2.0

Jupyter Notebook 100.00%

credit-card-fraud-detection's Introduction

Credit-Card-Fraud-Detection

Identify fraudulent credit card transactions.

Description

Credit card companies should be to recognize fraudulent credit card transactions so that customers are not charged for items that they did not purchase.However, it is an extremely challenging task as there might be only 1000 fraud cases in over a million transactions, representing a meager 0.1% of the dataset, leading to highly imbalanced datasets. The ML algorithms are very likely to produce faulty classifiers when they are trained with imbalanced datasets as they tend to show a bias for the majority class, treating the minority class as a noise in the dataset. Also, due to the class imbalance "accuracy" is not a meaningful metric for unbalanced classification. The algorithm would be able to predict almost all cases belonging to the majority class which will yield a high accuracy score. However, the minority class would be totally ignored by the algorithm. The Accuracy Score would give a false sense of security to the credit card companies which can cost individuals and businesses lots of money.

Dataset

The dataset used in this project have 492 fraudulent transactions out of 284,807 transactions. The dataset is highly unbalanced, the positive class (frauds) account for only 0.172% of all transactions. The dataset is available for download at https://www.kaggle.com/mlg-ulb/creditcardfraud

Algorithms

I have used three classification algorithms namely Logistic Regression CV, Random Forest Classifier and XGBoost Classifier. I have trained the classifier using the original dataset and a dataset obtained after performing Synthetic Minority Over-Sampling Technique (SMOTE) on the original dataset. I have split the data into training and test set at a ratio of 70:30.

Metrics Used to Evaluate Classifier Performance

I have used F1 Score, Recall, Precision, Confusion Matrix, Average precision-recall score and Average ROC_AUC score as metrics to evaluate the classifiers as they give a better indication of the model compared to accuracy.

Results

The Logistic Regression gives the best Recall score on the original dataset among the three algorithms. However, it lags the other two classifiers on all other metrics. XGBoost gives the best F1 score among the classifiers. Using the classifiers on the SMOTE dataset improves the Recall of the models at the cost of Precision and F1 Score.

credit-card-fraud-detection's People

Contributors

manashpratim avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.