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
}