Data Visualization
Model Prediction

Project Information

  • Category: Machine Learning / Fraud Detection
  • Project date: June 2024

Card Fraud Detection Using XGBoost

Project Overview

This project focuses on detecting fraudulent credit card transactions using machine learning. It was a final year internship project completed by me and my team during our internship at IIDT as AI-ML-DS Interns. We utilized the XGBoost algorithm for classification and prediction of fraudulent transactions.

Data Source

  • Source: Kaggle.com
  • Data Link: Credit Card Fraud Detection Dataset 2023

Required Libraries

  • Python (3.x): Primary programming language for implementation.
  • NumPy: For numerical computing and handling arrays.
  • Pandas: For data manipulation and analysis.
  • Matplotlib & Seaborn: For data visualization.
  • Imbalanced-learn: For handling imbalanced datasets.
  • Scikit-learn: Comprehensive machine learning library for various algorithms.
  • TensorFlow or PyTorch: Deep learning frameworks for building neural networks (if needed).
  • Keras: High-level neural networks API.
  • Scikit-plot: For plotting common machine learning metrics.
  • XGBoost or LightGBM: Gradient boosting libraries for effective classification.

Project Features

  • Model Training: The XGBoost algorithm was used to train the model on the credit card fraud dataset.
  • Feature Selection: The features used for training include anonymized transaction data labeled V1 to V28, along with the transaction amount.
  • Model Deployment: A Streamlit application was developed for easy interaction with the model, allowing users to input transaction details and get predictions on whether the transaction is legitimate or fraudulent.

Implementation Details

  • Data Loading: The dataset is loaded using Pandas.
  • Model Loading: The pre-trained XGBoost model is loaded from a pickle file.
  • Streamlit App: A user-friendly interface is created using Streamlit, where users can input a transaction ID to check the legitimacy of the transaction.
  • Prediction: The model takes the transaction details, processes the data, and predicts if the transaction is legitimate or fraudulent.
  • Result Display: The result is displayed on the Streamlit app, indicating whether the transaction is legitimate or fraudulent.

User Interaction

  • Transaction ID Input: Users can input a transaction ID to check its status.
  • Submit Button: On clicking the submit button, the app fetches the corresponding transaction details from the dataset.
  • Prediction Result: The app displays whether the transaction is legitimate or fraudulent based on the model's prediction.

Skills Demonstrated

  • Machine Learning: Application of the XGBoost algorithm for fraud detection.
  • Data Handling: Efficient manipulation and processing of large datasets using Pandas and NumPy.
  • Visualization: Use of Matplotlib and Seaborn for data exploration and visualization.
  • Model Deployment: Creating an interactive web application using Streamlit.
  • Team Collaboration: Working collaboratively on a real-world problem during an internship.

Conclusion

This project highlights the application of machine learning in detecting fraudulent credit card transactions. The use of XGBoost for classification, combined with a user-friendly Streamlit interface, demonstrates a comprehensive approach to solving a critical financial problem. The project showcases my proficiency in machine learning, data processing, and web application development, making it a valuable addition to my portfolio.