Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,195 +1,202 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
- **
|
| 16 |
-
- **
|
| 17 |
-
- **
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
- **
|
| 23 |
-
- **
|
| 24 |
-
- **
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
-
|
| 30 |
-
-
|
| 31 |
-
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
###
|
| 36 |
-
-
|
| 37 |
-
-
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
-
|
| 41 |
-
|
| 42 |
-
###
|
| 43 |
-
-
|
| 44 |
-
-
|
| 45 |
-
-
|
| 46 |
-
-
|
| 47 |
-
-
|
| 48 |
-
|
| 49 |
-
###
|
| 50 |
-
-
|
| 51 |
-
-
|
| 52 |
-
-
|
| 53 |
-
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
βββ π
|
| 70 |
-
β βββ
|
| 71 |
-
β
|
| 72 |
-
β
|
| 73 |
-
βββ
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
βββ
|
| 77 |
-
βββ
|
| 78 |
-
βββ
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
#
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
```
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
```
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
-
|
| 107 |
-
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
-
|
| 123 |
-
-
|
| 124 |
-
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
-
|
| 130 |
-
-
|
| 131 |
-
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
-
|
| 136 |
-
-
|
| 137 |
-
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
```
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
```
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
##
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
-
|
| 193 |
-
|
| 194 |
-
-
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Fraud-Detection-System
|
| 3 |
+
sdk: streamlit
|
| 4 |
+
emoji: π
|
| 5 |
+
colorFrom: indigo
|
| 6 |
+
colorTo: purple
|
| 7 |
+
---
|
| 8 |
+
# π³ Credit Card & Transaction Fraud Detection System
|
| 9 |
+
|
| 10 |
+
## Overview
|
| 11 |
+
A sophisticated real-time fraud detection system using ensemble machine learning models and advanced analytics to protect financial transactions.
|
| 12 |
+
|
| 13 |
+
### π Key Features
|
| 14 |
+
- **Real-time Fraud Detection**: Instant transaction monitoring and analysis
|
| 15 |
+
- **Multi-Model Ensemble**: XGBoost, LightGBM, Random Forest, and Gradient Boosting
|
| 16 |
+
- **Advanced Analytics Dashboard**: Interactive visualizations and insights
|
| 17 |
+
- **Role-Based Access Control**: User, Analyst, Manager, and Admin roles
|
| 18 |
+
- **Email Alert System**: Automated notifications for suspicious activities
|
| 19 |
+
- **Batch Processing**: Handle multiple transactions simultaneously
|
| 20 |
+
|
| 21 |
+
## π Technical Stack
|
| 22 |
+
- **Frontend**: Streamlit
|
| 23 |
+
- **Backend**: Python
|
| 24 |
+
- **ML Models**:
|
| 25 |
+
- XGBoost
|
| 26 |
+
- LightGBM
|
| 27 |
+
- Random Forest
|
| 28 |
+
- Gradient Boosting
|
| 29 |
+
- **Data Processing**: Pandas, NumPy
|
| 30 |
+
- **Visualization**: Plotly, Matplotlib
|
| 31 |
+
- **Security**: SHA-256 encryption
|
| 32 |
+
|
| 33 |
+
## π Features In Detail
|
| 34 |
+
|
| 35 |
+
### 1. Fraud Detection
|
| 36 |
+
- Real-time transaction scoring
|
| 37 |
+
- Risk level assessment (LOW, MEDIUM, HIGH, CRITICAL)
|
| 38 |
+
- Behavioral analysis
|
| 39 |
+
- Location-based risk assessment
|
| 40 |
+
- Velocity checks
|
| 41 |
+
|
| 42 |
+
### 2. User Interface
|
| 43 |
+
- Interactive dashboards
|
| 44 |
+
- Real-time monitoring
|
| 45 |
+
- Advanced visualization
|
| 46 |
+
- Risk score breakdown
|
| 47 |
+
- Transaction patterns analysis
|
| 48 |
+
|
| 49 |
+
### 3. Security Features
|
| 50 |
+
- Role-based access control
|
| 51 |
+
- Password encryption
|
| 52 |
+
- Session management
|
| 53 |
+
- Activity logging
|
| 54 |
+
- Audit trails
|
| 55 |
+
|
| 56 |
+
### 4. Alert System
|
| 57 |
+
- Email notifications
|
| 58 |
+
- Risk-based alerting
|
| 59 |
+
- Customizable thresholds
|
| 60 |
+
- Batch alert processing
|
| 61 |
+
|
| 62 |
+
## π Dataset
|
| 63 |
+
The dataset used for this project is the [Credit Card Fraud Detection](https://www.kaggle.com/datasets/priyamchoksi/credit-card-transactions-dataset?resource=download&select=credit_card_transactions.csv)
|
| 64 |
+
dataset from Kaggle.
|
| 65 |
+
|
| 66 |
+
## π Project Structure
|
| 67 |
+
```
|
| 68 |
+
Credit-Card-Fraud-Detection/
|
| 69 |
+
βββ π data/ # Data directory
|
| 70 |
+
β βββ users.csv # User credentials and roles
|
| 71 |
+
β βββ transactions.csv # Dataset of credit card transactions
|
| 72 |
+
β βββ models/ # ML model implementations
|
| 73 |
+
β βββ xgb_model.json # XGBoost model file
|
| 74 |
+
β βββ features.pkl # Saved feature configurations
|
| 75 |
+
β
|
| 76 |
+
βββ π .streamlit/ # Streamlit configurations
|
| 77 |
+
β βββ config.toml # Streamlit settings
|
| 78 |
+
β βββ secrets.toml # Secure credentials
|
| 79 |
+
β
|
| 80 |
+
βββ π app.py # Main Streamlit application
|
| 81 |
+
βββ π requirements.txt # Project dependencies
|
| 82 |
+
βββ π .env # Environment variables
|
| 83 |
+
βββ π .gitignore # Git ignore patterns
|
| 84 |
+
βββ π LICENSE # License information
|
| 85 |
+
βββ π README.md # Project documentation
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
## π οΈ Installation
|
| 89 |
+
|
| 90 |
+
1. Clone the repository:
|
| 91 |
+
```bash
|
| 92 |
+
git clone https://github.com/D3V-S4NJ4Y/Credit-Card-Fraud-Detection-System
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
2. Install required packages:
|
| 96 |
+
```bash
|
| 97 |
+
pip install -r requirements.txt
|
| 98 |
+
```
|
| 99 |
+
4. Run the application:
|
| 100 |
+
```bash
|
| 101 |
+
streamlit run app.py
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## π₯ User Roles
|
| 105 |
+
|
| 106 |
+
**Default--> Usersname: Password**
|
| 107 |
+
- admin: admin
|
| 108 |
+
- manager: 123456
|
| 109 |
+
- Register New User with Correct Email id for Email Alerts
|
| 110 |
+
|
| 111 |
+
1. **User**
|
| 112 |
+
- View basic transaction details
|
| 113 |
+
- Submit transactions
|
| 114 |
+
- Receive alerts
|
| 115 |
+
|
| 116 |
+
3. **Manager**
|
| 117 |
+
- Advanced analysis
|
| 118 |
+
- Team management
|
| 119 |
+
- Performance monitoring
|
| 120 |
+
|
| 121 |
+
4. **Admin**
|
| 122 |
+
- Full system access
|
| 123 |
+
- User management
|
| 124 |
+
- System configuration
|
| 125 |
+
|
| 126 |
+
## π Analytics Features
|
| 127 |
+
|
| 128 |
+
### Transaction Analysis
|
| 129 |
+
- Risk scoring
|
| 130 |
+
- Behavioral patterns
|
| 131 |
+
- Anomaly detection
|
| 132 |
+
- Historical analysis
|
| 133 |
+
|
| 134 |
+
### Visualization
|
| 135 |
+
- 3D risk analysis
|
| 136 |
+
- Decision flow diagrams
|
| 137 |
+
- Risk component breakdown
|
| 138 |
+
- Performance metrics
|
| 139 |
+
|
| 140 |
+
### Reporting
|
| 141 |
+
- Real-time dashboards
|
| 142 |
+
- Batch analysis reports
|
| 143 |
+
- Custom filters
|
| 144 |
+
- Export capabilities
|
| 145 |
+
|
| 146 |
+
## βοΈ Configuration
|
| 147 |
+
|
| 148 |
+
### Email Setup
|
| 149 |
+
```python
|
| 150 |
+
EMAIL_CONFIG = {
|
| 151 |
+
"smtp_user": "your-email@gmail.com",
|
| 152 |
+
"smtp_password": "your-app-password",
|
| 153 |
+
"smtp_server": "smtp.gmail.com",
|
| 154 |
+
"smtp_port": 587
|
| 155 |
+
}
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
### Risk Thresholds
|
| 159 |
+
```python
|
| 160 |
+
RISK_THRESHOLDS = {
|
| 161 |
+
'CRITICAL': 0.9,
|
| 162 |
+
'HIGH': 0.7,
|
| 163 |
+
'MEDIUM': 0.5,
|
| 164 |
+
'LOW': 0.2
|
| 165 |
+
}
|
| 166 |
+
```
|
| 167 |
+
|
| 168 |
+
## π Security Best Practices
|
| 169 |
+
|
| 170 |
+
1. Use environment variables for sensitive data
|
| 171 |
+
2. Regular password updates
|
| 172 |
+
3. Session timeout implementation
|
| 173 |
+
4. Activity logging
|
| 174 |
+
5. Data encryption
|
| 175 |
+
|
| 176 |
+
## π Logs and Monitoring
|
| 177 |
+
|
| 178 |
+
- System health monitoring
|
| 179 |
+
- User activity logs
|
| 180 |
+
- Model performance tracking
|
| 181 |
+
- Error logging
|
| 182 |
+
|
| 183 |
+
## π License
|
| 184 |
+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
|
| 185 |
+
|
| 186 |
+
## π¨βπ» Author
|
| 187 |
+
**Sanjay Kumar**
|
| 188 |
+
- Email: sanjay.dev925@gmail.com
|
| 189 |
+
- GitHub: [Your GitHub Profile](https://github.com/D3V-S4NJ4Y)
|
| 190 |
+
|
| 191 |
+
## π Acknowledgments
|
| 192 |
+
- Machine Learning libraries contributors
|
| 193 |
+
- Streamlit community
|
| 194 |
+
- Security framework developers
|
| 195 |
+
|
| 196 |
+
## π Support
|
| 197 |
+
For support and queries:
|
| 198 |
+
- Create an issue in the repository
|
| 199 |
+
- Contact: sanjay.dev925@gmail.com
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
β Star this repository if you find it helpful!
|