Harshk525 commited on
Commit
89b2220
Β·
verified Β·
1 Parent(s): bbcdc88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +177 -168
README.md CHANGED
@@ -1,168 +1,177 @@
1
- # Fraud Detection System
2
-
3
- An interactive web application for real-time fraud detection using machine learning.
4
-
5
- ## Features
6
-
7
- - **Real-time Analysis**: Instant fraud detection with probability scores
8
- - **Interactive Interface**: User-friendly web interface with Bootstrap styling
9
- - **Machine Learning**: Random Forest classifier trained on transaction data
10
- - **Risk Assessment**: 5-level risk classification (Very Low to Very High)
11
- - **Visual Results**: Progress bars and color-coded risk indicators
12
-
13
- ## Installation
14
-
15
- 1. **Install Python dependencies:**
16
- ```bash
17
- pip install -r requirements.txt
18
- ```
19
-
20
- 2. **Run the application:**
21
- ```bash
22
- python app.py
23
- ```
24
-
25
- 3. **Or use the batch file (Windows):**
26
- ```bash
27
- start_app.bat
28
- ```
29
-
30
- ## Usage
31
-
32
- 1. Open your browser and go to `http://localhost:5000`
33
- 2. Fill in the transaction details:
34
- - Personal Information (Gender, Age, Location)
35
- - Account Information (Bank Branch, Account Type, Balance)
36
- - Transaction Information (Amount, Type, Device, etc.)
37
- 3. Click "Analyze Transaction"
38
- 4. View the fraud probability and risk assessment
39
-
40
- ## Input Fields
41
-
42
- ### Personal Information
43
- - **Gender**: Female or Male
44
- - **Age**: Age of the account holder (18-100)
45
- - **State**: Indian states (Andhra Pradesh to Ladakh)
46
- - **City**: Major Indian cities (Mumbai, Delhi, Bangalore, etc.)
47
-
48
- ### Account Information
49
- - **Bank Branch**: Indian bank branches (SBI, HDFC, ICICI, etc.)
50
- - **Account Type**: Savings, Current, Credit Card, Fixed Deposit, Salary, Joint
51
- - **Account Balance**: Current account balance in Indian Rupees (β‚Ή)
52
-
53
- ### Transaction Information
54
- - **Transaction Amount**: Amount being transacted in Indian Rupees (β‚Ή)
55
- - **Transaction Type**: ATM Withdrawal, Bank Deposit, Fund Transfer, UPI Payment, etc.
56
- - **Transaction Device**: ATM, POS, Mobile Apps, UPI platforms, Internet Banking, etc.
57
- - **Transaction Date**: Day of month (1-31)
58
- - **Transaction Time**: Hourly time slots (24-hour format)
59
- - **Currency**: INR (default), USD, EUR, GBP, AED, SGD, CAD, AUD
60
-
61
- ## API Endpoints
62
-
63
- ### GET /
64
- Returns the main web interface
65
-
66
- ### POST /predict
67
- **Request Body:**
68
- ```json
69
- {
70
- "gender": "1",
71
- "age": "35",
72
- "state": "15",
73
- "city": "127",
74
- "bank_branch": "127",
75
- "account_type": "2",
76
- "transaction_date": "22",
77
- "transaction_time": "52151",
78
- "transaction_amount": "32415.45",
79
- "transaction_type": "3",
80
- "account_balance": "74557.27",
81
- "transaction_device": "17",
82
- "transaction_currency": "0"
83
- }
84
- ```
85
-
86
- **Response:**
87
- ```json
88
- {
89
- "prediction": 0,
90
- "fraud_probability": 15.75,
91
- "risk_level": "Very Low",
92
- "risk_color": "#28a745",
93
- "message": "Legitimate Transaction"
94
- }
95
- ```
96
-
97
- ## Risk Levels
98
-
99
- - **Very Low** (0-20%): Green (#28a745)
100
- - **Low** (20-40%): Teal (#20c997)
101
- - **Medium** (40-60%): Yellow (#ffc107)
102
- - **High** (60-80%): Orange (#fd7e14)
103
- - **Very High** (80-100%): Red (#dc3545)
104
-
105
- ## Testing
106
-
107
- Run the API test script:
108
- ```bash
109
- python test_api.py
110
- ```
111
-
112
- ## Files Structure
113
-
114
- ```
115
- fraud_flask_app/
116
- β”œβ”€β”€ app.py # Main Flask application
117
- β”œβ”€β”€ model.pkl # Trained Random Forest model
118
- β”œβ”€β”€ encoders.pkl # Label encoders for categorical features
119
- β”œβ”€β”€ requirements.txt # Python dependencies
120
- β”œβ”€β”€ start_app.bat # Windows startup script
121
- β”œβ”€β”€ test_api.py # API testing script
122
- β”œβ”€β”€ templates/
123
- β”‚ └── index.html # Web interface template
124
- β”œβ”€β”€ static/
125
- β”‚ └── style.css # Custom styling
126
- └── README.md # This file
127
- ```
128
-
129
- ## Model Information
130
-
131
- - **Algorithm**: Random Forest Classifier
132
- - **Features**: 13 input features
133
- - **Training Data**: Bank transaction fraud dataset
134
- - **Performance**: Optimized for fraud detection accuracy
135
-
136
- ## Technologies Used
137
-
138
- - **Backend**: Flask (Python)
139
- - **Frontend**: HTML5, CSS3, JavaScript, Bootstrap 5
140
- - **Machine Learning**: scikit-learn, pandas, numpy
141
- - **Icons**: Font Awesome
142
-
143
- ## Browser Support
144
-
145
- - Chrome/Chromium (recommended)
146
- - Firefox
147
- - Safari
148
- - Edge
149
-
150
- ## Troubleshooting
151
-
152
- ### Model Loading Issues
153
- - Ensure `model.pkl` and `encoders.pkl` are in the same directory as `app.py`
154
- - Check Python package versions match requirements.txt
155
-
156
- ### Connection Issues
157
- - Verify Flask is running on port 5000
158
- - Check firewall settings
159
- - Ensure no other application is using port 5000
160
-
161
- ### Prediction Errors
162
- - Validate all input fields are filled correctly
163
- - Check input value ranges match the specified limits
164
- - Ensure numeric fields contain valid numbers
165
-
166
- ## License
167
-
168
- This project is for educational and demonstration purposes.
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ title: Fraud_Detection_using_ML
4
+ sdk: docker
5
+ emoji: 🏒
6
+ colorFrom: green
7
+ colorTo: red
8
+ pinned: true
9
+ ---
10
+ # Fraud Detection System
11
+
12
+ An interactive web application for real-time fraud detection using machine learning.
13
+
14
+ ## Features
15
+
16
+ - **Real-time Analysis**: Instant fraud detection with probability scores
17
+ - **Interactive Interface**: User-friendly web interface with Bootstrap styling
18
+ - **Machine Learning**: Random Forest classifier trained on transaction data
19
+ - **Risk Assessment**: 5-level risk classification (Very Low to Very High)
20
+ - **Visual Results**: Progress bars and color-coded risk indicators
21
+
22
+ ## Installation
23
+
24
+ 1. **Install Python dependencies:**
25
+ ```bash
26
+ pip install -r requirements.txt
27
+ ```
28
+
29
+ 2. **Run the application:**
30
+ ```bash
31
+ python app.py
32
+ ```
33
+
34
+ 3. **Or use the batch file (Windows):**
35
+ ```bash
36
+ start_app.bat
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ 1. Open your browser and go to `http://localhost:5000`
42
+ 2. Fill in the transaction details:
43
+ - Personal Information (Gender, Age, Location)
44
+ - Account Information (Bank Branch, Account Type, Balance)
45
+ - Transaction Information (Amount, Type, Device, etc.)
46
+ 3. Click "Analyze Transaction"
47
+ 4. View the fraud probability and risk assessment
48
+
49
+ ## Input Fields
50
+
51
+ ### Personal Information
52
+ - **Gender**: Female or Male
53
+ - **Age**: Age of the account holder (18-100)
54
+ - **State**: Indian states (Andhra Pradesh to Ladakh)
55
+ - **City**: Major Indian cities (Mumbai, Delhi, Bangalore, etc.)
56
+
57
+ ### Account Information
58
+ - **Bank Branch**: Indian bank branches (SBI, HDFC, ICICI, etc.)
59
+ - **Account Type**: Savings, Current, Credit Card, Fixed Deposit, Salary, Joint
60
+ - **Account Balance**: Current account balance in Indian Rupees (β‚Ή)
61
+
62
+ ### Transaction Information
63
+ - **Transaction Amount**: Amount being transacted in Indian Rupees (β‚Ή)
64
+ - **Transaction Type**: ATM Withdrawal, Bank Deposit, Fund Transfer, UPI Payment, etc.
65
+ - **Transaction Device**: ATM, POS, Mobile Apps, UPI platforms, Internet Banking, etc.
66
+ - **Transaction Date**: Day of month (1-31)
67
+ - **Transaction Time**: Hourly time slots (24-hour format)
68
+ - **Currency**: INR (default), USD, EUR, GBP, AED, SGD, CAD, AUD
69
+
70
+ ## API Endpoints
71
+
72
+ ### GET /
73
+ Returns the main web interface
74
+
75
+ ### POST /predict
76
+ **Request Body:**
77
+ ```json
78
+ {
79
+ "gender": "1",
80
+ "age": "35",
81
+ "state": "15",
82
+ "city": "127",
83
+ "bank_branch": "127",
84
+ "account_type": "2",
85
+ "transaction_date": "22",
86
+ "transaction_time": "52151",
87
+ "transaction_amount": "32415.45",
88
+ "transaction_type": "3",
89
+ "account_balance": "74557.27",
90
+ "transaction_device": "17",
91
+ "transaction_currency": "0"
92
+ }
93
+ ```
94
+
95
+ **Response:**
96
+ ```json
97
+ {
98
+ "prediction": 0,
99
+ "fraud_probability": 15.75,
100
+ "risk_level": "Very Low",
101
+ "risk_color": "#28a745",
102
+ "message": "Legitimate Transaction"
103
+ }
104
+ ```
105
+
106
+ ## Risk Levels
107
+
108
+ - **Very Low** (0-20%): Green (#28a745)
109
+ - **Low** (20-40%): Teal (#20c997)
110
+ - **Medium** (40-60%): Yellow (#ffc107)
111
+ - **High** (60-80%): Orange (#fd7e14)
112
+ - **Very High** (80-100%): Red (#dc3545)
113
+
114
+ ## Testing
115
+
116
+ Run the API test script:
117
+ ```bash
118
+ python test_api.py
119
+ ```
120
+
121
+ ## Files Structure
122
+
123
+ ```
124
+ fraud_flask_app/
125
+ β”œβ”€β”€ app.py # Main Flask application
126
+ β”œβ”€β”€ model.pkl # Trained Random Forest model
127
+ β”œβ”€β”€ encoders.pkl # Label encoders for categorical features
128
+ β”œβ”€β”€ requirements.txt # Python dependencies
129
+ β”œβ”€β”€ start_app.bat # Windows startup script
130
+ β”œβ”€β”€ test_api.py # API testing script
131
+ β”œβ”€β”€ templates/
132
+ β”‚ └── index.html # Web interface template
133
+ β”œβ”€β”€ static/
134
+ β”‚ └── style.css # Custom styling
135
+ └── README.md # This file
136
+ ```
137
+
138
+ ## Model Information
139
+
140
+ - **Algorithm**: Random Forest Classifier
141
+ - **Features**: 13 input features
142
+ - **Training Data**: Bank transaction fraud dataset
143
+ - **Performance**: Optimized for fraud detection accuracy
144
+
145
+ ## Technologies Used
146
+
147
+ - **Backend**: Flask (Python)
148
+ - **Frontend**: HTML5, CSS3, JavaScript, Bootstrap 5
149
+ - **Machine Learning**: scikit-learn, pandas, numpy
150
+ - **Icons**: Font Awesome
151
+
152
+ ## Browser Support
153
+
154
+ - Chrome/Chromium (recommended)
155
+ - Firefox
156
+ - Safari
157
+ - Edge
158
+
159
+ ## Troubleshooting
160
+
161
+ ### Model Loading Issues
162
+ - Ensure `model.pkl` and `encoders.pkl` are in the same directory as `app.py`
163
+ - Check Python package versions match requirements.txt
164
+
165
+ ### Connection Issues
166
+ - Verify Flask is running on port 5000
167
+ - Check firewall settings
168
+ - Ensure no other application is using port 5000
169
+
170
+ ### Prediction Errors
171
+ - Validate all input fields are filled correctly
172
+ - Check input value ranges match the specified limits
173
+ - Ensure numeric fields contain valid numbers
174
+
175
+ ## License
176
+
177
+ This project is for educational and demonstration purposes.