Credit Card Fraud Detection System using Python Machine Learning
The Credit Card Fraud Detection System is designed to identify and prevent fraudulent credit card transactions using Machine Learning algorithms integrated with the Django framework. The project aims to detect unusual transaction behavior based on parameters like transaction amount, merchant category, and transaction location (country). Fraudulent activities have become increasingly complex, and traditional detection systems often fail to identify evolving fraud patterns. Therefore, this system leverages data analytics and machine learning to improve accuracy and speed in fraud detection.
The project uses a classification algorithm such as Logistic Regression, Decision Tree, or Random Forest trained on a dataset containing both legitimate and fraudulent transactions. The model predicts the probability of a transaction being fraudulent in real time. A probability threshold is set, and transactions exceeding it are flagged as suspicious. The web interface developed in Django allows users and administrators to view flagged transactions, train models, and test new data.
🛠️ Tech Stack Used
Frontend / Web Interface:
- Django (Python Web Framework) – Used to create the web interface for user input, displaying predictions, and managing data
- HTML5, CSS3, JavaScript – For rendering and styling web pages
- Bootstrap (optional) – For responsive UI components
- Django Templates – For dynamic web page rendering
🧠 Machine Learning / Backend Logic:
- scikit-learn – Machine Learning library used to implement algorithms like Logistic Regression, Decision Tree, Random Forest, KNN
- NumPy→ For numerical operations and matrix manipulation
- Pandas → For handling and preprocessing datasets
- joblib → To save and load the trained machine learning model
🗃️ Database:
- SQLite – Lightweight relational database used to store user data and predictions
- Django ORM (Object Relational Mapper) – Handles interaction between Django models and the SQLite database
⚙️ Tools & Environment:
- Python 3.x – Core programming language used
- PyCharm – IDE for development
- Virtualenv / pip – For managing dependencies
✅ Key Features
1. Administrator Features
Administrators hold the highest level of access in the system. To maintain integrity, only registered and verified admin users can log in and manage the application.
Key Features:
- User Registration & Management: Admins can view all registered users, assign or update their roles (e.g., promoting a user to Analyst or Reviewer), and manage profiles.
- Access Control: Admins ensure that only authorized individuals can access sensitive features like fraud review or model retraining.
- Model Management: Admins can upload CSV files to train or retrain the fraud detection model.
- System Monitoring: Admins can view all flagged transactions, system logs, and reports for analysis.
This ensures complete control over both users and data security within the system.
2. Analyst Features
Analysts are registered users who focus on data processing and model operations.
Key Features:
- Secure Login: Analysts must log in using their credentials to gain access to data analytics tools and model training pages.
- Model Training and Evaluation: Analysts can upload new transaction data in CSV format to retrain or test the model.
- Fraud Prediction Testing: Analysts can use the “Check Transaction” page to analyze transaction details and review fraud probability.
- Data Insights: Analysts observe fraud trends and performance metrics to refine prediction accuracy.
By enforcing login, all analyst activities are tracked, ensuring accountability and secure data handling.
3. Reviewer Features
Reviewers play a critical role in validating flagged transactions. Only registered reviewers can log in to access flagged data.
Key Features:
- Fraud Verification: Reviewers can view all transactions flagged by the system’s machine learning model.
- Decision Logging: After analyzing a transaction, reviewers can mark it as legitimate or fraudulent.
- Coordination with Analysts: Their feedback helps improve future model accuracy.
Registration and login ensure that only authorised reviewers can access sensitive fraud data, preventing misuse.
Credit Card Fraud Detection ML Project: Output Screenshot
Home Page

User Registration

Transaction Check page

Train Model Page

Flagged Transactions

Manage users

How to run the Credit Card fraud Detection System using Python Machine Learning (ML)
1. Download the zip file
2. Extract the file, copy credit_fraud_project, the folder and paste it on the desktop
3. Open PyCharm and import the project into PyCharm
4. Install four libraries (if not installed)
|
1 2 3 4 |
pip install joblib pip install numpy pip install scikit-learn pip install pandas |
5. Run the Project using the following command
python manage.py runserver
Now, click the URL http://127.0.0.1:800,0 and the Project will run
Login Details
*************admin************
Username: admin
Password: Test@123
*************Analyst ************
Username: testanlayst
Password: Test@123
Or register a new Analyst.
*************Reviewer************
Username: testreviewer
Password: Test@123
Or Register a new Reviewer.
