This project utilizes machine learning techniques to detect fraudulent credit card transactions. By analyzing transaction data, the model aims to accurately identify fraudulent activities, providing a robust solution for fraud detection in financial systems.
To run this project, you'll need to download the dataset from the following link:
Note: Place the downloaded CSV file in the same directory as your main and test files.
The project consists of two main files:
This file contains the main code for training the machine learning model and evaluating its performance. It performs the following tasks:
- Loads the dataset (
creditcard.csv
) into a Pandas DataFrame. - Explores and visualizes the dataset to understand its structure and characteristics.
- Prepares the data for training by splitting it into features (X) and labels (Y).
- Divides the dataset into training and testing sets using Scikit-learn's
train_test_split
function. - Builds a Random Forest Classifier model and trains it on the training data.
- Evaluates the model's performance using various metrics such as accuracy, precision, recall, F1-score, and Matthews correlation coefficient.
- Generates a confusion matrix to visualize the classification results.
This file contains code for testing the trained model on a separate dataset or real-time transactions. It performs similar tasks to main.py
but is focused on applying the model to new data rather than training it.
- Download Dataset: Download the dataset from the provided link and place it in the project directory.
- Install Dependencies: Make sure you have all the required Python libraries installed, including NumPy, Pandas, Matplotlib, Seaborn, and Scikit-learn.
- Run
main.py
: Execute themain.py
file to train the machine learning model and evaluate its performance. - Run
test.py
: Optionally, run thetest.py
file to test the trained model on new data or real-time transactions.
This project is licensed under the MIT License.