Delete Tests.ipynb
Browse files- Tests.ipynb +0 -218
Tests.ipynb
DELETED
@@ -1,218 +0,0 @@
|
|
1 |
-
Here are sample inputs to test the fraud detection system and their expected outputs:
|
2 |
-
|
3 |
-
## π§ͺ **Test Cases with Expected Results**
|
4 |
-
|
5 |
-
### **Test Case 1: Normal Grocery Purchase** β
|
6 |
-
**Input:**
|
7 |
-
```
|
8 |
-
Transaction ID: NORMAL_001
|
9 |
-
Amount: $45.67
|
10 |
-
Merchant Category: grocery
|
11 |
-
Description: WALMART SUPERCENTER CA 1234
|
12 |
-
Hour: 14 (2 PM)
|
13 |
-
Day of Week: 2 (Tuesday)
|
14 |
-
Days Since Last Transaction: 1.0
|
15 |
-
Transactions (1h): 1
|
16 |
-
Transactions (24h): 3
|
17 |
-
Avg Amount (1h): $50.00
|
18 |
-
Location Risk Score: 0.1
|
19 |
-
Account Age (days): 730
|
20 |
-
```
|
21 |
-
|
22 |
-
**Expected Output:**
|
23 |
-
```
|
24 |
-
π― Prediction: β
LEGITIMATE
|
25 |
-
π Fraud Probability: 0.1234 (12.34%)
|
26 |
-
β οΈ Risk Level: LOW
|
27 |
-
π Risk Meter: [ββββββββββββββββββββ] 12.3%
|
28 |
-
π Detailed Scores:
|
29 |
-
π€ BERT Score: 0.0892
|
30 |
-
ποΈ Isolation Score: -0.2145
|
31 |
-
π Anomaly Score: 0.1567
|
32 |
-
|
33 |
-
π Summary:
|
34 |
-
π° Amount: $45.67
|
35 |
-
πͺ Category: grocery
|
36 |
-
π Description: WALMART SUPERCENTER CA 1234
|
37 |
-
π― Fraud Probability: 0.1234 (12.34%)
|
38 |
-
π Risk Level: LOW
|
39 |
-
```
|
40 |
-
|
41 |
-
---
|
42 |
-
|
43 |
-
### **Test Case 2: Suspicious High Amount Transaction** π¨
|
44 |
-
**Input:**
|
45 |
-
```
|
46 |
-
Transaction ID: SUSPICIOUS_001
|
47 |
-
Amount: $2999.99
|
48 |
-
Merchant Category: online
|
49 |
-
Description: SUSPICIOUS ELECTRONICS STORE XX 9999
|
50 |
-
Hour: 3 (3 AM)
|
51 |
-
Day of Week: 6 (Saturday)
|
52 |
-
Days Since Last Transaction: 60.0
|
53 |
-
Transactions (1h): 12
|
54 |
-
Transactions (24h): 25
|
55 |
-
Avg Amount (1h): $150.00
|
56 |
-
Location Risk Score: 0.95
|
57 |
-
Account Age (days): 15
|
58 |
-
```
|
59 |
-
|
60 |
-
**Expected Output:**
|
61 |
-
```
|
62 |
-
π― Prediction: π¨ FRAUD DETECTED
|
63 |
-
π Fraud Probability: 0.8567 (85.67%)
|
64 |
-
β οΈ Risk Level: CRITICAL
|
65 |
-
π Risk Meter: [ββββββββββββββββββββ] 85.7%
|
66 |
-
π Detailed Scores:
|
67 |
-
π€ BERT Score: 0.7834
|
68 |
-
ποΈ Isolation Score: 0.6721
|
69 |
-
π Anomaly Score: 0.8945
|
70 |
-
|
71 |
-
π Summary:
|
72 |
-
π° Amount: $2999.99
|
73 |
-
πͺ Category: online
|
74 |
-
π Description: SUSPICIOUS ELECTRONICS STORE XX 9999
|
75 |
-
π― Fraud Probability: 0.8567 (85.67%)
|
76 |
-
π Risk Level: CRITICAL
|
77 |
-
```
|
78 |
-
|
79 |
-
---
|
80 |
-
|
81 |
-
### **Test Case 3: Coffee Shop Purchase** β
|
82 |
-
**Input:**
|
83 |
-
```
|
84 |
-
Transaction ID: COFFEE_001
|
85 |
-
Amount: $8.50
|
86 |
-
Merchant Category: restaurant
|
87 |
-
Description: STARBUCKS COFFEE NY 5678
|
88 |
-
Hour: 8 (8 AM)
|
89 |
-
Day of Week: 1 (Monday)
|
90 |
-
Days Since Last Transaction: 0.5
|
91 |
-
Transactions (1h): 1
|
92 |
-
Transactions (24h): 4
|
93 |
-
Avg Amount (1h): $8.50
|
94 |
-
Location Risk Score: 0.2
|
95 |
-
Account Age (days): 1095
|
96 |
-
```
|
97 |
-
|
98 |
-
**Expected Output:**
|
99 |
-
```
|
100 |
-
π― Prediction: β
LEGITIMATE
|
101 |
-
π Fraud Probability: 0.0789 (7.89%)
|
102 |
-
β οΈ Risk Level: MINIMAL
|
103 |
-
π Risk Meter: [ββββββββββββββββββββ] 7.9%
|
104 |
-
π Detailed Scores:
|
105 |
-
π€ BERT Score: 0.0456
|
106 |
-
ποΈ Isolation Score: -0.3421
|
107 |
-
π Anomaly Score: 0.0234
|
108 |
-
|
109 |
-
π Summary:
|
110 |
-
π° Amount: $8.50
|
111 |
-
πͺ Category: restaurant
|
112 |
-
π Description: STARBUCKS COFFEE NY 5678
|
113 |
-
π― Fraud Probability: 0.0789 (7.89%)
|
114 |
-
π Risk Level: MINIMAL
|
115 |
-
```
|
116 |
-
|
117 |
-
---
|
118 |
-
|
119 |
-
### **Test Case 4: Foreign ATM Withdrawal** β οΈ
|
120 |
-
**Input:**
|
121 |
-
```
|
122 |
-
Transaction ID: ATM_001
|
123 |
-
Amount: $500.00
|
124 |
-
Merchant Category: atm
|
125 |
-
Description: ATM WITHDRAWAL FOREIGN COUNTRY 0000
|
126 |
-
Hour: 23 (11 PM)
|
127 |
-
Day of Week: 0 (Sunday)
|
128 |
-
Days Since Last Transaction: 0.1
|
129 |
-
Transactions (1h): 5
|
130 |
-
Transactions (24h): 8
|
131 |
-
Avg Amount (1h): $200.00
|
132 |
-
Location Risk Score: 0.8
|
133 |
-
Account Age (days): 365
|
134 |
-
```
|
135 |
-
|
136 |
-
**Expected Output:**
|
137 |
-
```
|
138 |
-
π― Prediction: π¨ FRAUD DETECTED
|
139 |
-
π Fraud Probability: 0.6743 (67.43%)
|
140 |
-
β οΈ Risk Level: HIGH
|
141 |
-
π Risk Meter: [ββββββββββββββββββββ] 67.4%
|
142 |
-
π Detailed Scores:
|
143 |
-
π€ BERT Score: 0.5987
|
144 |
-
ποΈ Isolation Score: 0.4521
|
145 |
-
π Anomaly Score: 0.7234
|
146 |
-
|
147 |
-
π Summary:
|
148 |
-
π° Amount: $500.00
|
149 |
-
πͺ Category: atm
|
150 |
-
π Description: ATM WITHDRAWAL FOREIGN COUNTRY 0000
|
151 |
-
π― Fraud Probability: 0.6743 (67.43%)
|
152 |
-
π Risk Level: HIGH
|
153 |
-
```
|
154 |
-
|
155 |
-
---
|
156 |
-
|
157 |
-
### **Test Case 5: Crypto Transaction** π¨
|
158 |
-
**Input:**
|
159 |
-
```
|
160 |
-
Transaction ID: CRYPTO_001
|
161 |
-
Amount: $1250.75
|
162 |
-
Merchant Category: online
|
163 |
-
Description: CRYPTO EXCHANGE WITHDRAW BTC
|
164 |
-
Hour: 2 (2 AM)
|
165 |
-
Day of Week: 5 (Friday)
|
166 |
-
Days Since Last Transaction: 0.02
|
167 |
-
Transactions (1h): 15
|
168 |
-
Transactions (24h): 30
|
169 |
-
Avg Amount (1h): $800.00
|
170 |
-
Location Risk Score: 0.85
|
171 |
-
Account Age (days): 45
|
172 |
-
```
|
173 |
-
|
174 |
-
**Expected Output:**
|
175 |
-
```
|
176 |
-
π― Prediction: π¨ FRAUD DETECTED
|
177 |
-
π Fraud Probability: 0.9123 (91.23%)
|
178 |
-
β οΈ Risk Level: CRITICAL
|
179 |
-
π Risk Meter: [ββββββββββββββββββββ] 91.2%
|
180 |
-
π Detailed Scores:
|
181 |
-
π€ BERT Score: 0.8765
|
182 |
-
ποΈ Isolation Score: 0.7891
|
183 |
-
π Anomaly Score: 0.9234
|
184 |
-
|
185 |
-
π Summary:
|
186 |
-
π° Amount: $1250.75
|
187 |
-
πͺ Category: online
|
188 |
-
π Description: CRYPTO EXCHANGE WITHDRAW BTC
|
189 |
-
π― Fraud Probability: 0.9123 (91.23%)
|
190 |
-
π Risk Level: CRITICAL
|
191 |
-
```
|
192 |
-
|
193 |
-
---
|
194 |
-
|
195 |
-
## π― **How to Test:**
|
196 |
-
|
197 |
-
1. **Quick Test**: Use the "Load Sample" dropdown to automatically populate fields with these test cases
|
198 |
-
2. **Manual Test**: Copy the input values manually into the interface
|
199 |
-
3. **Custom Test**: Modify any values to see how they affect the fraud probability
|
200 |
-
|
201 |
-
## π **Understanding Risk Levels:**
|
202 |
-
|
203 |
-
- **MINIMAL** (0-20%): Very low fraud risk, typical normal transactions
|
204 |
-
- **LOW** (20-40%): Slightly elevated but generally safe
|
205 |
-
- **MEDIUM** (40-60%): Moderate risk, requires attention
|
206 |
-
- **HIGH** (60-80%): High fraud probability, should be flagged
|
207 |
-
- **CRITICAL** (80-100%): Very high fraud risk, immediate action needed
|
208 |
-
|
209 |
-
## π **Key Fraud Indicators:**
|
210 |
-
|
211 |
-
- **High amounts** at unusual times (late night/early morning)
|
212 |
-
- **Foreign locations** with high risk scores
|
213 |
-
- **Suspicious descriptions** with unusual merchant names
|
214 |
-
- **High transaction frequency** in short time periods
|
215 |
-
- **New accounts** with large transactions
|
216 |
-
- **Weekend/night** transactions combined with other risk factors
|
217 |
-
|
218 |
-
These test cases cover the spectrum from clearly legitimate transactions to obvious fraud attempts, helping you validate that the model is working correctly!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|