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