An end-to-end Machine Learning Project
Credit card fraud is an inclusive term for fraud committed using a payment card, such as a credit card or debit card. The purpose may be to obtain goods or services or to make payment to another account, which is controlled by a criminal.
This Streamlit App utilizes a Machine Learning model served as an API with FastAPI framework in order to detect fraudulent credit card transactions based on the following criteria: hours, type of transaction, amount, balance before and after transaction, etc.
The machine learning model used for this web application was deployed as an API using the FastAPI framework and then accessed through a frontend interface with Streamlit.
Publicly accessible datasets on financial services are scarce, particularly in the newly growing field of mobile money transfers. Many scholars, like us who conduct research in the field of fraud detection, value financial datasets. Because financial transactions are inherently private, there are no publicly accessible datasets, which contributes to the problem.
A synthetic dataset generated using the simulator called PaySim was used as the dataset for building the model used in this project. PaySim uses aggregated data from the private dataset to generate a synthetic dataset that resembles the normal operation of transactions and injects malicious behavior to later evaluate the performance of fraud detection methods.
In this project, 2 different classification algorithms were tested namely:
- Logistic Regression
- Random Forest
The final model used for the API was the Random Forest Classifier model which had an accuracy score of 0.99 and an F1 score of 0.86.
streamlit-streamlit_app-2024-07-19-03-07-80.webm
💻 Running the API on Google Colab
To run a demo or carry out testing with the API it's best to do that with Google Colab. To run/test the API on Google Colab do the following:
- Clone the repository to your Google Colab Instance.