Adey Innovations Inc. is committed to enhancing fraud detection mechanisms for e-commerce transactions and bank credit transactions. This project aims to develop robust machine learning models for fraud detection, leveraging geolocation analysis and transaction pattern recognition. The solution includes advanced model interpretability, real-time monitoring, and API-based deployment for integration into financial systems.
- Data Analysis and Preprocessing
- Model Building and Training
- Model Explainability
- Model Deployment and API Development
- Dashboard Development
- Business Impact
- Installation and Usage
- Impute or drop missing values
- Remove duplicate entries
- Correct data types
- Univariate analysis
- Bivariate analysis
- Convert IP addresses to integer format
- Merge
Fraud_Data.csv
withIpAddress_to_Country.csv
- Transaction frequency and velocity
- Time-based features:
hour_of_day
day_of_week
- Encode categorical features
- Separate features and target variables (
Class
increditcard.csv
,class
inFraud_Data.csv
) - Train-test split
Multiple models are tested for performance:
- Logistic Regression
- Decision Tree
- Random Forest
- Gradient Boosting
- Multi-Layer Perceptron (MLP)
- Convolutional Neural Network (CNN)
- Recurrent Neural Network (RNN)
- Long Short-Term Memory (LSTM)
- Train models on both datasets
- Use MLflow for experiment tracking, logging parameters, metrics, and model versioning.
- Summary Plot
- Force Plot
- Dependence Plot
- Feature Importance Plot
serve_model.py
for serving predictionsrequirements.txt
listing dependencies
- Define API endpoints
- Test API functionality
Dockerfile:
FROM python:3.8-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "serve_model.py"]
Commands:
docker build -t fraud-detection-model .
docker run -p 5000:5000 fraud-detection-model
- Integrate logging for tracking API requests and fraud predictions.
Using Flask and Dash:
- Flask backend serves fraud data via API endpoints.
- Dash frontend visualizes insights.
- Summary boxes for total transactions, fraud cases, and fraud percentage.
- Line chart tracking fraud trends over time.
- Geolocation fraud analysis.
- Bar chart comparing fraud cases by device and browser.
- Improved fraud detection accuracy for banking and e-commerce.
- Enhanced transaction security, reducing financial losses.
- Real-time fraud monitoring and risk mitigation.
- Strengthened customer trust in financial institutions.
- Clone the repository:
git clone https://github.com/Ethel-Star/Advanced-Fraud-Detection-for-E-Commerce-and-Banking.git cd Advanced-Fraud-Detection
- Install dependencies:
pip install -r requirements.txt
- Run Flask API:
python serve_model.py
- Deploy with Docker:
docker build -t fraud-detection-model . docker run -p 5000:5000 fraud-detection-model
- Start Dashboard:
python dashboard.py
This project is licensed under the Apache License