Giter Club home page Giter Club logo

credit-card-fraud's Introduction

Credit Card Fraud Analysis

Analysis of credit card fraud data using neural networks.

Dataset

The datasets contains credit card transactions over a two day collection period in September 2013 by European cardholders. There are a total of 284,807 transactions, of which 492 (0.172%) are fraudulent.

The dataset contains numerical variables that are the result of a principal components analysis (PCA) transformation. This transformation was applied by the original authors to maintain confidentiality of sensitive information. Additionally the dataset contains Time and Amount, which were not transformed by PCA. The Time variable contains the seconds elapsed between each transaction and the first transaction in the dataset. The Amount variable is the transaction amount, this feature can be used for example-dependant cost-senstive learning. The Class variable is the response variable and indicates whether the transaction was fraudulant.

The dataset was collected and analysed during a research collaboration of Worldline and the Machine Learning Group of Université Libre de Bruxelles (ULB) on big data mining and fraud detection.

Model

The model is a stratified k-fold multi-layer perceptron (MLP) neural network, implemented in Python using the Keras module and Theano backend (although you can use TensorFlow if you like).

Run the model using the following command:

KERAS_BACKEND=theano ipython src/model.py

Performance

The model achieves an overall f1 score of 0.99, with 99% sensitivity and 14% precision for the positive class. That is, the model correctly identifies 99% of the fraud cases (true positives) but only 14% of the transactions predicted as fraudulent were actually fraudulent.

The classification report and cross-tabulation are below:

             precision    recall  f1-score   support

        0.0       1.00      0.99      0.99    284315
        1.0       0.14      0.99      0.24       492

avg / total       1.00      0.99      0.99    284807

Predictions       0     1
Truth                    
0.0          281250  3065
1.0               6   486

Reference

Andrea Dal Pozzolo, Olivier Caelen, Reid A. Johnson and Gianluca Bontempi. Calibrating Probability with Undersampling for Unbalanced Classification. In Symposium on Computational Intelligence and Data Mining (CIDM), IEEE, 2015 (PDF)

License

The data was released under Open Database License and individual contents under Database Contents License.

This code repository is released under the MIT "Expat" License.

credit-card-fraud's People

Contributors

ellisvalentiner avatar

Watchers

 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.