KEY INSIGHT
Smallholder farmers and informal sector workers need financial tools that work without constant connectivity and understand local economic contexts.
Financial inclusion means bringing banking, credit, and insurance services to populations historically excluded from formal financial systems. In many African markets, this means serving people with no credit history, irregular income, and mobile-first (or mobile-only) access.
Local AI for financial services includes credit scoring using alternative data—crop yields, mobile money transaction histories, agricultural commodity prices—along with fraud detection that learns local fraud patterns.
```python
# Alternative credit scoring for smallholder farmers
import numpy as np
from collections import defaultdict
class FarmCreditScorer:
def __init__(self, local_model_path=None):
self.transaction_history = defaultdict(list)
self.crop_records = {}
self.repayment_log = {}
def score_applicant(self, applicant_id, features):
"""
features: dict with keys like
- 'mobile_transactions_6m': list of monthly totals
- 'crop_yields': dict of crop->kg
- 'input_purchases': list of agricultural input values
- 'phone_recharge_pattern': average monthly spend
"""
components = []
# Transaction regularity (40% weight)
if features.get('mobile_transactions_6m'):
tx_mean = np.mean(features['mobile_transactions_6m'])
tx_std = np.std(features['mobile_transactions_6m'])
regularity = 1 - min(tx_std / (tx_mean + 1), 1)
components.append(('regularity', regularity, 0.40))
# Crop productivity vs regional average (30% weight)
if features.get('crop_yields'):
productivity_score = self._assess_productivity(features['crop_yields'])
components.append(('productivity', productivity_score, 0.30))
# Input investment ratio (20% weight)
if features.get('input_purchases') and features.get('crop_yields'):
total_inputs = sum(features['input_purchases'])
total_output = sum(features['crop_yields'].values())
if total_output > 0:
efficiency = min(total_output / (total_inputs + 1), 5) / 5
components.append(('efficiency', efficiency, 0.20))
# Mobile money usage patterns (10% weight)
if features.get('phone_recharge_pattern'):
recharge_ratio = features['phone_recharge_pattern'][0] / 10000
components.append(('recharge_discipline', min(recharge_ratio, 1), 0.10))
# Calculate weighted score
total_score = sum(score * weight for _, score, weight in components)
return {
'score': round(total_score * 100, 2),
'tier': self._assign_tier(total_score),
'max_loan': self._calculate_limit(total_score),
'risk_factors': self._identify_risks(components)
}
def _assess_productivity(self, yields):
# Compare to baseline yields for region
baseline = {'maize': 1500, 'rice': 2000, 'cassava': 8000}
scores = []
for crop, kg in yields.items():
if crop in baseline:
ratio = kg / baseline[crop]
scores.append(min(ratio, 2)) # Cap at 2x baseline
return np.mean(scores) / 2 if scores else 0.5
def _assign_tier(self, score):
if score >= 0.8: return "excellent"
elif score >= 0.6: return "good"
elif score >= 0.4: return "fair"
else: return "building"
```
The model accepts data from mobile money providers, cooperative records, and input suppliers—sources that exist even for unbanked individuals. Processing happens locally, reducing data privacy concerns since sensitive financial data never leaves the device.