This project focuses on enhancing the sensitivity and accuracy of fraud detection systems by combining supervised learning and anomaly detection techniques. The goal is to identify both known and novel fraud patterns, ensuring that financial institutions can detect fraudulent activities more effectively and reduce losses.
If you find this project useful, please consider giving it a star ⭐ on GitHub. Contributions are also welcome!
- Improve Fraud Detection: Enhance the existing fraud detection system by incorporating advanced anomaly detection techniques.
- Identify Novel Fraud Patterns: Use unsupervised learning methods to detect rare or previously unseen fraud patterns.
- Minimise False Positives: Ensure the system accurately identifies fraudulent transactions while minimising false alarms.
- Deploy the Model: Create a real-time fraud detection system using FastAPI for deployment.
- pandas, numpy: Data manipulation and preprocessing.
- scikit-learn: Machine learning models and evaluation metrics.
- tensorflow, keras: Deep learning models (if required).
- matplotlib, seaborn: Data visualisation.
- joblib: Saving and loading trained models.
- fastapi, uvicorn: Deployment of the model as a REST API.
- GitHub for collaboration and version control.
The dataset used in this project contains credit card transactions, with the following features:
- V1-V28: Anonymized features representing transaction details.
- Amount: The transaction amount.
- Class: The target variable (0 for non-fraudulent, 1 for fraudulent).
- Import the necessary libraries and load the dataset containing historical credit card transactions.
- Inspect and prepare the dataset for preprocessing.
- Handle missing values.
- Encode categorical variables (if any).
- Normalize numerical features using
StandardScaler
orMinMaxScaler
. - Split the dataset into training and testing sets.
- Use a combination of traditional machine learning models and anomaly detection techniques:
- Logistic Regression
- Decision Tree Classifier
- Random Forest Classifier
- Isolation Forest
- One-Class SVM
- Autoencoder Model
- Train supervised learning models using labeled data.
- Evaluate models for accuracy in classifying fraudulent transactions.
- Train anomaly detection models to identify outliers or anomalies.
- Detect novel fraud patterns not represented in the training data.
- Combine supervised and anomaly detection models using techniques like majority voting or weighted averaging.
Evaluate model performance using:
- Accuracy
- Precision
- Recall
- F1-Score
- ROC-AUC
- Serialise trained models using
joblib
orpickle
.
- Deploy the models using FastAPI to create a REST API for real-time predictions.
- Test the deployed API with sample transaction data.
- Monitor the application for performance or prediction errors.
- Clone the repository:
git clone https://github.com/nafisalawalidris/Advanced-Fraud-Detection-with-Anomaly-Detection.git
- Clone the Repository
git clone https://github.com/nafisalawalidris/Fraud-Detection-with-Supervised-Learning.git
- Navigate to the project directory:
cd Advanced-Fraud-Detection-with-Anomaly-Detection
- Create a virtual environment:
python -m venv Advanced-Fraud-Detection-env
- Activate the virtual environment:
- On Windows:
.\Advanced-Fraud-Detection-env\Scripts\activate
- On macOS/Linux
source Advanced-Fraud-Detection-env/bin/activate
- Install the required packages:
pip install -r requirements.txt
Contributions are welcome! If you have suggestions for improvements or want to contribute to this project, follow these steps:
1. Fork the repository.
2. Create a new feature branch (git checkout -b feature-name).
3. Commit your changes (git commit -m 'Add some feature').
4. Push to the branch (git push origin feature-name).
5. Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more information.
For any inquiries or feedback, feel free to reach out: https://nafisalawalidris.github.io/13/.