Update README.md (#2)
Browse files- Update README.md (a422c819d86a6d921c2da1ccc1e94c3c7c0afe28)
README.md
CHANGED
@@ -7,49 +7,337 @@ tags:
|
|
7 |
size_categories:
|
8 |
- 1M<n<10M
|
9 |
---
|
10 |
-
|
11 |
-
|
12 |
-
##
|
13 |
-
|
14 |
-
This is a
|
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 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
size_categories:
|
8 |
- 1M<n<10M
|
9 |
---
|
10 |
+
Nigerian Financial Fraud Detection Dataset (Enhanced)
|
11 |
+
|
12 |
+
## Overview
|
13 |
+
|
14 |
+
This is a comprehensive synthetic financial fraud detection dataset specifically engineered for the Nigerian fintech ecosystem. The dataset contains **5,000,000 transactions** with **45 advanced features** including sophisticated user behavior analytics, device intelligence, risk scoring, and temporal patterns tailored for Nigerian financial fraud detection.
|
15 |
+
|
16 |
+
### Key Highlights
|
17 |
+
|
18 |
+
- π³π¬ **Nigerian-Localized**: Currency (NGN), cities, payment channels, IP ranges
|
19 |
+
- π§ **Advanced Features**: 30 sophisticated fraud detection features
|
20 |
+
- π **Production-Ready**: No data leakage, optimized for ML training
|
21 |
+
- π **Behavioral Analytics**: User personas, transaction patterns, device intelligence
|
22 |
+
- β‘ **High-Performance**: Engineered for 5M+ transaction processing
|
23 |
+
|
24 |
+
## Dataset Statistics
|
25 |
+
|
26 |
+
- **Total Transactions**: 5,000,000
|
27 |
+
- **Total Features**: 45
|
28 |
+
- **Fraud Rate**: ~15% (realistic for emerging markets)
|
29 |
+
- **Time Span**: Simulated 12-month period
|
30 |
+
- **Unique Users**: ~500,000 sender accounts
|
31 |
+
- **Nigerian Cities**: 20 major cities across 6 geo-regions
|
32 |
+
|
33 |
+
## Feature Categories
|
34 |
+
|
35 |
+
### π¦ Core Transaction Features (15 features)
|
36 |
+
|
37 |
+
- `transaction_id`: Unique transaction identifier
|
38 |
+
- `sender_account`: Anonymized 10-digit Nigerian account number
|
39 |
+
- `receiver_account`: Anonymized 10-digit Nigerian account number
|
40 |
+
- `amount_ngn`: Transaction amount in Nigerian Naira (NGN)
|
41 |
+
- `timestamp`: Transaction timestamp with Nigerian business patterns
|
42 |
+
- `payment_channel`: Nigerian payment methods (USSD, Mobile App, Card, Bank Transfer)
|
43 |
+
- `merchant_category`: Localized merchants (Jumia, MTN Airtime, Bet9ja, etc.)
|
44 |
+
- `location`: Major Nigerian cities
|
45 |
+
- `ip_address`: IP addresses from Nigerian IP ranges
|
46 |
+
- `device_hash`: Anonymized device identifier
|
47 |
+
- `is_fraud`: Binary fraud label (0=legitimate, 1=fraud)
|
48 |
+
- `fraud_type`: Specific fraud categories (Account Takeover, Identity Fraud, etc.)
|
49 |
+
- `bvn_linked`: Bank Verification Number linkage status
|
50 |
+
- `sender_persona`: Behavioral profile (Salary Earner, Student, Trader)
|
51 |
+
- `geospatial_velocity_anomaly`: Impossible travel pattern flag
|
52 |
+
|
53 |
+
### π€ User Behavior Features (5 features)
|
54 |
+
|
55 |
+
- `user_avg_txn_amt`: Average transaction amount per user (expanding window)
|
56 |
+
- `user_std_txn_amt`: Standard deviation of user's transaction amounts
|
57 |
+
- `user_top_category`: Most frequent merchant category per user
|
58 |
+
- `user_txn_frequency_24h`: Transaction frequency indicator
|
59 |
+
- `user_txn_count_total`: Lifetime transaction count per user
|
60 |
+
|
61 |
+
### π± Device & IP Intelligence (5 features)
|
62 |
+
|
63 |
+
- `device_seen_count`: Total transactions from each device
|
64 |
+
- `is_device_shared`: Flag for devices used by multiple users (0/1)
|
65 |
+
- `ip_seen_count`: Total transactions from each IP address
|
66 |
+
- `is_ip_shared`: Flag for IPs used by multiple users (0/1)
|
67 |
+
- `ip_geo_region`: Nigerian geo-region (South West, North Central, etc.)
|
68 |
+
|
69 |
+
### π Transaction History/Window Features (4 features)
|
70 |
+
|
71 |
+
- `txn_count_last_1h`: Recent transaction count (expanding window)
|
72 |
+
- `txn_count_last_24h`: 24-hour transaction count (expanding window)
|
73 |
+
- `total_amount_last_1h`: Sum of recent transactions (expanding window)
|
74 |
+
- `avg_gap_between_txns`: Average time between user transactions (minutes)
|
75 |
+
|
76 |
+
### β οΈ Risk Scoring Fields (4 features)
|
77 |
+
|
78 |
+
- `merchant_fraud_rate`: Historical fraud rate per merchant category (no leakage)
|
79 |
+
- `channel_risk_score`: Risk score by payment channel (USSD=0.8, Mobile=0.6, etc.)
|
80 |
+
- `persona_fraud_risk`: Risk by user persona (Trader=0.7, Student=0.5, etc.)
|
81 |
+
- `location_fraud_risk`: Historical fraud rate per Nigerian city (no leakage)
|
82 |
+
|
83 |
+
### π Temporal Features (4 features)
|
84 |
+
|
85 |
+
- `txn_hour`: Transaction hour (0-23)
|
86 |
+
- `is_weekend`: Weekend transaction flag (0/1)
|
87 |
+
- `is_salary_week`: Last 5 days of month flag (0/1)
|
88 |
+
- `is_night_txn`: Night transaction flag 11pm-5am (0/1)
|
89 |
+
|
90 |
+
### π§ Technical Features (8 features)
|
91 |
+
|
92 |
+
- `new_device_for_sender`: First-time device usage flag
|
93 |
+
- `shared_device_hash`: Device used by multiple accounts
|
94 |
+
- `time_since_last`: Minutes since user's last transaction
|
95 |
+
- Various derived flags and indicators
|
96 |
+
|
97 |
+
## Nigerian Localization Details
|
98 |
+
|
99 |
+
### ποΈ Geographic Coverage
|
100 |
+
|
101 |
+
**6 Nigerian Geo-Regions Represented:**
|
102 |
+
|
103 |
+
- **South West**: Lagos, Ibadan, Abeokuta, Oyo, Ogbomoso
|
104 |
+
- **North Central**: Abuja, Jos, Ilorin, Okene
|
105 |
+
- **North West**: Kano, Zaria, Kaduna, Sokoto
|
106 |
+
- **South South**: Port Harcourt, Benin City, Warri
|
107 |
+
- **South East**: Aba, Enugu, Onitsha
|
108 |
+
- **North East**: Maiduguri
|
109 |
+
|
110 |
+
### π³ Payment Channels (Risk-Weighted)
|
111 |
+
|
112 |
+
- **USSD** (Risk: 0.8) - Most common, highest fraud risk
|
113 |
+
- **Mobile App** (Risk: 0.6) - Moderate risk
|
114 |
+
- **Card** (Risk: 0.4) - Lower risk
|
115 |
+
- **Bank Transfer** (Risk: 0.3) - Lowest risk
|
116 |
+
|
117 |
+
### π Merchant Categories (Nigerian Context)
|
118 |
+
|
119 |
+
- Jumia Purchase, Konga Shopping, MTN Airtime Top-up
|
120 |
+
- Airtel Data Bundle, Bet9ja Stake, NairaBet Gaming
|
121 |
+
- Uber Ride, Bolt Transport, Flutterwave Payment
|
122 |
+
- Paystack Transaction, Opay Transfer, PalmPay Service
|
123 |
+
- And 10+ other Nigerian-specific merchants
|
124 |
+
|
125 |
+
### π₯ User Personas (Behavioral Profiles)
|
126 |
+
|
127 |
+
- **Salary Earner** (Risk: 0.4): Regular monthly patterns, moderate amounts
|
128 |
+
- **Student** (Risk: 0.5): Small frequent transactions, education-related
|
129 |
+
- **Trader** (Risk: 0.7): High-volume, irregular patterns, higher risk
|
130 |
+
|
131 |
+
## Fraud Types and Scenarios
|
132 |
+
|
133 |
+
### π¨ Fraud Categories Included
|
134 |
+
|
135 |
+
1. **Account Takeover**: Compromised accounts with unusual patterns
|
136 |
+
2. **Identity Fraud**: Fake accounts, unlinked BVN
|
137 |
+
3. **Impossible Travel Fraud**: Geospatial velocity anomalies
|
138 |
+
4. **SIM Swap Fraud**: Device changes with suspicious activity
|
139 |
+
5. **Card-Not-Present**: Online fraud without physical card
|
140 |
+
6. **Deposit Fraud**: Fake deposit schemes
|
141 |
+
7. **Money Laundering**: Structured transactions, unusual patterns
|
142 |
+
|
143 |
+
### π― Fraud Detection Signals
|
144 |
+
|
145 |
+
- BVN linkage status (unlinked = higher risk)
|
146 |
+
- New device usage patterns
|
147 |
+
- Shared device/IP indicators
|
148 |
+
- Geospatial velocity anomalies
|
149 |
+
- Off-hours transaction patterns
|
150 |
+
- Unusual merchant category combinations
|
151 |
+
- Rapid transaction sequences
|
152 |
+
|
153 |
+
## Technical Implementation
|
154 |
+
|
155 |
+
### π Data Privacy & Security
|
156 |
+
|
157 |
+
- All account numbers are randomly generated (no real accounts)
|
158 |
+
- Device hashes are anonymized identifiers
|
159 |
+
- IP addresses are from public Nigerian ranges
|
160 |
+
- No personally identifiable information (PII) included
|
161 |
+
|
162 |
+
### π Feature Engineering Methodology
|
163 |
+
|
164 |
+
- **No Data Leakage**: Risk scores use expanding windows with `.shift(1)`
|
165 |
+
- **Temporal Consistency**: Features computed chronologically
|
166 |
+
- **Performance Optimized**: Efficient groupby operations for 5M+ rows
|
167 |
+
- **Realistic Patterns**: Based on Nigerian fintech transaction behaviors
|
168 |
+
|
169 |
+
### π Rolling Window Logic
|
170 |
+
|
171 |
+
```python
|
172 |
+
# Example: Merchant fraud rate without leakage
|
173 |
+
merchant_fraud_rate = df.groupby('merchant_category')['is_fraud']
|
174 |
+
.transform(lambda x: x.expanding().mean().shift(1).fillna(0.1))
|
175 |
+
```
|
176 |
+
|
177 |
+
## Use Cases & Applications
|
178 |
+
|
179 |
+
### π― Primary Use Cases
|
180 |
+
|
181 |
+
1. **Fraud Detection Model Training**: Supervised learning with rich feature set
|
182 |
+
2. **Risk Scoring System Development**: Real-time transaction scoring
|
183 |
+
3. **Behavioral Analytics**: User pattern analysis and segmentation
|
184 |
+
4. **Anomaly Detection**: Unsupervised fraud detection research
|
185 |
+
5. **Nigerian Fintech Research**: Emerging market fraud patterns
|
186 |
+
|
187 |
+
### π’ Target Industries
|
188 |
+
|
189 |
+
- Nigerian fintech companies (Flutterwave, Paystack, Opay, etc.)
|
190 |
+
- Traditional banks expanding digital services
|
191 |
+
- Fraud detection technology vendors
|
192 |
+
- Academic research institutions
|
193 |
+
- Regulatory bodies and compliance teams
|
194 |
+
|
195 |
+
### π Model Performance Expectations
|
196 |
+
|
197 |
+
- **Baseline Accuracy**: 85-90% with basic features
|
198 |
+
- **Enhanced Accuracy**: 92-95% with advanced features
|
199 |
+
- **Precision/Recall**: Optimized for Nigerian fraud patterns
|
200 |
+
- **Real-time Scoring**: Features designed for low-latency inference
|
201 |
+
|
202 |
+
## Data Quality & Validation
|
203 |
+
|
204 |
+
### β
Quality Assurance
|
205 |
+
|
206 |
+
- **Completeness**: No missing values in critical features
|
207 |
+
- **Consistency**: Logical relationships maintained across features
|
208 |
+
- **Realism**: Patterns based on Nigerian financial behaviors
|
209 |
+
- **Balance**: Appropriate fraud/legitimate transaction ratio
|
210 |
+
|
211 |
+
### π Validation Metrics
|
212 |
+
|
213 |
+
- Transaction amounts follow realistic Nigerian distributions
|
214 |
+
- Temporal patterns align with Nigerian business hours
|
215 |
+
- Geographic distribution matches Nigerian population centers
|
216 |
+
- Fraud patterns consistent with emerging market trends
|
217 |
+
|
218 |
+
## Limitations & Considerations
|
219 |
+
|
220 |
+
### β οΈ Important Limitations
|
221 |
+
|
222 |
+
1. **Synthetic Data**: Not real transactions, patterns may differ from reality
|
223 |
+
2. **Temporal Scope**: Limited to 12-month simulation period
|
224 |
+
3. **Feature Completeness**: May not capture all real-world fraud signals
|
225 |
+
4. **Regional Focus**: Specific to Nigerian context, may not generalize
|
226 |
+
5. **Fraud Evolution**: Real fraud patterns evolve faster than synthetic data
|
227 |
+
|
228 |
+
### π― Recommended Usage
|
229 |
+
|
230 |
+
- Use as training data supplement, not replacement for real data
|
231 |
+
- Validate model performance on real Nigerian transaction data
|
232 |
+
- Regular model retraining as fraud patterns evolve
|
233 |
+
- Combine with external data sources for production systems
|
234 |
+
|
235 |
+
## Technical Specifications
|
236 |
+
|
237 |
+
### π File Details
|
238 |
+
|
239 |
+
- **Format**: CSV (Comma-separated values)
|
240 |
+
- **Size**: ~2.5GB uncompressed
|
241 |
+
- **Encoding**: UTF-8
|
242 |
+
- **Delimiter**: Comma (,)
|
243 |
+
- **Header**: Yes (first row contains column names)
|
244 |
+
|
245 |
+
### π§ System Requirements
|
246 |
+
|
247 |
+
- **Memory**: 8GB+ RAM recommended for full dataset loading
|
248 |
+
- **Storage**: 5GB+ available space
|
249 |
+
- **Processing**: Multi-core CPU recommended for feature engineering
|
250 |
+
- **Software**: Python 3.7+, pandas 1.3+, numpy 1.20+
|
251 |
+
|
252 |
+
## Getting Started
|
253 |
+
|
254 |
+
### π Quick Start Example
|
255 |
+
|
256 |
+
```python
|
257 |
+
import pandas as pd
|
258 |
+
import numpy as np
|
259 |
+
from sklearn.ensemble import RandomForestClassifier
|
260 |
+
from sklearn.model_selection import train_test_split
|
261 |
+
|
262 |
+
# Load the dataset
|
263 |
+
df = pd.read_csv('financial_fraud_detection_dataset_nigeria.csv')
|
264 |
+
|
265 |
+
# Basic exploration
|
266 |
+
print(f"Dataset shape: {df.shape}")
|
267 |
+
print(f"Fraud rate: {df['is_fraud'].mean():.2%}")
|
268 |
+
print(f"Features: {df.columns.tolist()}")
|
269 |
+
|
270 |
+
# Feature selection for modeling
|
271 |
+
feature_cols = [col for col in df.columns if col not in ['transaction_id', 'is_fraud', 'fraud_type']]
|
272 |
+
X = df[feature_cols]
|
273 |
+
y = df['is_fraud']
|
274 |
+
|
275 |
+
# Train/test split
|
276 |
+
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
|
277 |
+
|
278 |
+
# Simple model training
|
279 |
+
model = RandomForestClassifier(n_estimators=100, random_state=42)
|
280 |
+
model.fit(X_train, y_train)
|
281 |
+
|
282 |
+
# Evaluate
|
283 |
+
accuracy = model.score(X_test, y_test)
|
284 |
+
print(f"Model accuracy: {accuracy:.2%}")
|
285 |
+
```
|
286 |
+
|
287 |
+
### π― Advanced Analytics Examples
|
288 |
+
|
289 |
+
```python
|
290 |
+
# Analyze fraud patterns by region
|
291 |
+
region_fraud = df.groupby('ip_geo_region')['is_fraud'].agg(['count', 'mean'])
|
292 |
+
print("Fraud rates by Nigerian region:")
|
293 |
+
print(region_fraud)
|
294 |
+
|
295 |
+
# User behavior analysis
|
296 |
+
user_stats = df.groupby('sender_persona').agg({
|
297 |
+
'amount_ngn': ['mean', 'std'],
|
298 |
+
'is_fraud': 'mean',
|
299 |
+
'user_txn_count_total': 'mean'
|
300 |
+
})
|
301 |
+
print("\nUser persona analysis:")
|
302 |
+
print(user_stats)
|
303 |
+
|
304 |
+
# Temporal fraud patterns
|
305 |
+
temporal_fraud = df.groupby(['txn_hour', 'is_weekend'])['is_fraud'].mean()
|
306 |
+
print("\nTemporal fraud patterns:")
|
307 |
+
print(temporal_fraud)
|
308 |
+
```
|
309 |
+
|
310 |
+
## Citation & Attribution
|
311 |
+
|
312 |
+
### π Recommended Citation
|
313 |
+
|
314 |
+
```
|
315 |
+
Nigerian Financial Fraud Detection Dataset (Enhanced)
|
316 |
+
Synthetic dataset for fraud detection research in Nigerian fintech
|
317 |
+
Generated: 2024
|
318 |
+
Features: 45 advanced fraud detection features
|
319 |
+
Transactions: 5,000,000 synthetic transactions
|
320 |
+
```
|
321 |
+
|
322 |
+
### π·οΈ Tags
|
323 |
+
|
324 |
+
`fraud-detection` `nigeria` `fintech` `machine-learning` `synthetic-data` `behavioral-analytics` `risk-scoring` `emerging-markets` `financial-crime` `anomaly-detection`
|
325 |
+
|
326 |
+
## Support & Updates
|
327 |
+
|
328 |
+
### π Contact Information
|
329 |
+
|
330 |
+
For questions, issues, or collaboration opportunities regarding this dataset, please refer to the project documentation or contact the development team.
|
331 |
+
|
332 |
+
### π Version History
|
333 |
+
|
334 |
+
- **v2.0** (Current): Enhanced with 30 advanced features, Nigerian localization
|
335 |
+
- **v1.0**: Basic fraud detection dataset with core features
|
336 |
+
|
337 |
+
### π Future Enhancements
|
338 |
+
|
339 |
+
- Transaction network analysis features
|
340 |
+
- Additional Nigerian payment channels
|
341 |
+
- Seasonal fraud pattern variations
|
342 |
+
- Enhanced merchant category coverage
|
343 |
+
- Real-time streaming data simulation
|