Credit Card Fraud Detection

Desktop app that checks if a credit card transaction is genuine or fraud, using a Random Forest model trained on 284,807 real transactions.

  • Price: ₹1,499
  • Category: AI / ML
  • Technology: Python, Tkinter, scikit-learn, Random Forest, SMOTE
  • Includes: Full source code
  • Suitable for: BCA / B.Sc CS, MCA / M.Sc CS, B.E / B.Tech CSE & IT

Project overview

A machine learning desktop application that detects fraudulent credit card transactions. Built and trained on Kaggle's public Credit Card Fraud Detection dataset (284,807 real anonymized European cardholder transactions, of which 492 are confirmed fraud). The app has two screens: Check Transaction, where you pick a sample or enter your own transaction values and get an instant Genuine/Fraud result with a confidence percentage, and Model Performance, which shows the model's real accuracy, precision, recall, F1-score and confusion matrix from testing on 85,443 transactions the model never saw during training. The severe class imbalance in this dataset (fraud is only 0.17% of transactions) is handled with SMOTE oversampling, applied correctly only to the training data after the train/test split, so the reported results are not inflated by data leakage - a common mistake in similar published tutorials for this exact dataset.

Modules

  1. Data loading & exploration: Loads the 284,807-row dataset, checks for missing values, and reports the class distribution (genuine vs fraud).
  2. Feature scaling: Scales the transaction Amount using StandardScaler so it is on the same scale as the other anonymized features.
  3. Train/test split: Splits the data 70/30 into training and test sets before any oversampling, to keep the test set as real, unseen data.
  4. SMOTE oversampling: Generates synthetic fraud examples on the training set only, to correct the 0.17% class imbalance without leaking data into the test set.
  5. Model training & comparison: Trains and compares Decision Tree and Random Forest classifiers, then trains the final Random Forest model on the balanced training data.
  6. Check Transaction screen: Pick a labelled sample transaction or enter your own 29 feature values, and get an instant Genuine/Fraud prediction with a confidence percentage.
  7. Model Performance screen: Shows accuracy, precision, recall, F1-score, and a live confusion matrix chart, with a plain-language explanation of what each number means.

Requirements

  • Python 3.10 or newer
  • Internet connection for the one-time pip install (about 2-5 minutes)
  • Windows, macOS or Linux (Tkinter is included with Python)

How to run this project

  1. Install Python 3 from python.org and tick "Add python.exe to PATH" during setup.
  2. Extract the zip and open a terminal in the project folder.
  3. Run `py -m pip install -r requirements.txt` (takes 2-5 minutes, installs pandas, scikit-learn, matplotlib and a few other libraries).
  4. Run `py fraud_app.py` to launch the app. The trained model is already included, so no training is needed to run it.
  5. On the Check Transaction tab, pick a sample from the dropdown (it shows whether that sample was actually genuine or fraud) and click Check Transaction.
  6. Open the Model Performance tab to see the model's real accuracy, precision, recall, F1-score and confusion matrix - useful for your project review.

More AI / ML projects