File size: 5,668 Bytes
7ad2a53 |
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 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
Here are sample inputs to test the fraud detection system and their expected outputs:
## π§ͺ **Test Cases with Expected Results**
### **Test Case 1: Normal Grocery Purchase** β
**Input:**
```
Transaction ID: NORMAL_001
Amount: $45.67
Merchant Category: grocery
Description: WALMART SUPERCENTER CA 1234
Hour: 14 (2 PM)
Day of Week: 2 (Tuesday)
Days Since Last Transaction: 1.0
Transactions (1h): 1
Transactions (24h): 3
Avg Amount (1h): $50.00
Location Risk Score: 0.1
Account Age (days): 730
```
**Expected Output:**
```
π― Prediction: β
LEGITIMATE
π Fraud Probability: 0.1234 (12.34%)
β οΈ Risk Level: LOW
π Risk Meter: [ββββββββββββββββββββ] 12.3%
π Detailed Scores:
π€ BERT Score: 0.0892
ποΈ Isolation Score: -0.2145
π Anomaly Score: 0.1567
π Summary:
π° Amount: $45.67
πͺ Category: grocery
π Description: WALMART SUPERCENTER CA 1234
π― Fraud Probability: 0.1234 (12.34%)
π Risk Level: LOW
```
---
### **Test Case 2: Suspicious High Amount Transaction** π¨
**Input:**
```
Transaction ID: SUSPICIOUS_001
Amount: $2999.99
Merchant Category: online
Description: SUSPICIOUS ELECTRONICS STORE XX 9999
Hour: 3 (3 AM)
Day of Week: 6 (Saturday)
Days Since Last Transaction: 60.0
Transactions (1h): 12
Transactions (24h): 25
Avg Amount (1h): $150.00
Location Risk Score: 0.95
Account Age (days): 15
```
**Expected Output:**
```
π― Prediction: π¨ FRAUD DETECTED
π Fraud Probability: 0.8567 (85.67%)
β οΈ Risk Level: CRITICAL
π Risk Meter: [ββββββββββββββββββββ] 85.7%
π Detailed Scores:
π€ BERT Score: 0.7834
ποΈ Isolation Score: 0.6721
π Anomaly Score: 0.8945
π Summary:
π° Amount: $2999.99
πͺ Category: online
π Description: SUSPICIOUS ELECTRONICS STORE XX 9999
π― Fraud Probability: 0.8567 (85.67%)
π Risk Level: CRITICAL
```
---
### **Test Case 3: Coffee Shop Purchase** β
**Input:**
```
Transaction ID: COFFEE_001
Amount: $8.50
Merchant Category: restaurant
Description: STARBUCKS COFFEE NY 5678
Hour: 8 (8 AM)
Day of Week: 1 (Monday)
Days Since Last Transaction: 0.5
Transactions (1h): 1
Transactions (24h): 4
Avg Amount (1h): $8.50
Location Risk Score: 0.2
Account Age (days): 1095
```
**Expected Output:**
```
π― Prediction: β
LEGITIMATE
π Fraud Probability: 0.0789 (7.89%)
β οΈ Risk Level: MINIMAL
π Risk Meter: [ββββββββββββββββββββ] 7.9%
π Detailed Scores:
π€ BERT Score: 0.0456
ποΈ Isolation Score: -0.3421
π Anomaly Score: 0.0234
π Summary:
π° Amount: $8.50
πͺ Category: restaurant
π Description: STARBUCKS COFFEE NY 5678
π― Fraud Probability: 0.0789 (7.89%)
π Risk Level: MINIMAL
```
---
### **Test Case 4: Foreign ATM Withdrawal** β οΈ
**Input:**
```
Transaction ID: ATM_001
Amount: $500.00
Merchant Category: atm
Description: ATM WITHDRAWAL FOREIGN COUNTRY 0000
Hour: 23 (11 PM)
Day of Week: 0 (Sunday)
Days Since Last Transaction: 0.1
Transactions (1h): 5
Transactions (24h): 8
Avg Amount (1h): $200.00
Location Risk Score: 0.8
Account Age (days): 365
```
**Expected Output:**
```
π― Prediction: π¨ FRAUD DETECTED
π Fraud Probability: 0.6743 (67.43%)
β οΈ Risk Level: HIGH
π Risk Meter: [ββββββββββββββββββββ] 67.4%
π Detailed Scores:
π€ BERT Score: 0.5987
ποΈ Isolation Score: 0.4521
π Anomaly Score: 0.7234
π Summary:
π° Amount: $500.00
πͺ Category: atm
π Description: ATM WITHDRAWAL FOREIGN COUNTRY 0000
π― Fraud Probability: 0.6743 (67.43%)
π Risk Level: HIGH
```
---
### **Test Case 5: Crypto Transaction** π¨
**Input:**
```
Transaction ID: CRYPTO_001
Amount: $1250.75
Merchant Category: online
Description: CRYPTO EXCHANGE WITHDRAW BTC
Hour: 2 (2 AM)
Day of Week: 5 (Friday)
Days Since Last Transaction: 0.02
Transactions (1h): 15
Transactions (24h): 30
Avg Amount (1h): $800.00
Location Risk Score: 0.85
Account Age (days): 45
```
**Expected Output:**
```
π― Prediction: π¨ FRAUD DETECTED
π Fraud Probability: 0.9123 (91.23%)
β οΈ Risk Level: CRITICAL
π Risk Meter: [ββββββββββββββββββββ] 91.2%
π Detailed Scores:
π€ BERT Score: 0.8765
ποΈ Isolation Score: 0.7891
π Anomaly Score: 0.9234
π Summary:
π° Amount: $1250.75
πͺ Category: online
π Description: CRYPTO EXCHANGE WITHDRAW BTC
π― Fraud Probability: 0.9123 (91.23%)
π Risk Level: CRITICAL
```
---
## π― **How to Test:**
1. **Quick Test**: Use the "Load Sample" dropdown to automatically populate fields with these test cases
2. **Manual Test**: Copy the input values manually into the interface
3. **Custom Test**: Modify any values to see how they affect the fraud probability
## π **Understanding Risk Levels:**
- **MINIMAL** (0-20%): Very low fraud risk, typical normal transactions
- **LOW** (20-40%): Slightly elevated but generally safe
- **MEDIUM** (40-60%): Moderate risk, requires attention
- **HIGH** (60-80%): High fraud probability, should be flagged
- **CRITICAL** (80-100%): Very high fraud risk, immediate action needed
## π **Key Fraud Indicators:**
- **High amounts** at unusual times (late night/early morning)
- **Foreign locations** with high risk scores
- **Suspicious descriptions** with unusual merchant names
- **High transaction frequency** in short time periods
- **New accounts** with large transactions
- **Weekend/night** transactions combined with other risk factors
These test cases cover the spectrum from clearly legitimate transactions to obvious fraud attempts, helping you validate that the model is working correctly! |