A comprehensive machine learning system that recommends optimal transaction amounts for UPI payments based on user behavior patterns, transaction categories, and contextual factors.
- Personalized Recommendations: Amount suggestions based on individual user spending patterns
- Context-Aware: Considers time, location, category, and payment method
- User Segmentation: Clusters users into spending behavior groups
- Real-time Predictions: Fast inference suitable for production environments
- New User Handling: Category-based recommendations for users without history
- Size: 10,000 synthetic UPI transactions
- Users: 1,000 unique users
- Categories: 10 transaction types (Food, Transportation, Shopping, etc.)
- Time Period: Full year of transaction data
- Features: 15+ engineered features for ML models
| Model | MAE (₹) | RMSE (₹) | R² Score |
|---|---|---|---|
| Random Forest | 475.68 | 776.90 | 0.595 |
| Gradient Boosting | 478.66 | 761.18 | 0.611 |
| Linear Regression | 786.49 | 1142.29 | 0.124 |
# Clone the repository
git clone [repository-url]
cd upi-recommendation-system
# Install dependencies
pip install -r requirements.txtfrom upi_recommendation_system import UPIRecommendationSystem
# Initialize the system
recommender = UPIRecommendationSystem()
recommender.load_data('upi_transactions_dataset.csv', 'user_behavior_profiles.csv')
# Get recommendation
recommendation = recommender.recommend_amount(
user_id='USER_0001',
category='Food & Dining',
location='Mumbai',
payment_method='PhonePe',
hour=13
)
print(f"Recommended Amount: ₹{recommendation['recommended_amount']}")python upi_recommendation_system.pyupi-recommendation-system/
├── upi_recommendation_system.py # Main application
├── upi_transactions_dataset.csv # Transaction data
├── user_behavior_profiles.csv # User analysis
├── feature_importance_analysis.csv # ML insights
├── project_info.json # Project metadata
├── api_examples.json # API samples
├── requirements.txt # Dependencies
└── README.md # Documentation
| Cluster | Description | Avg Amount | Users |
|---|---|---|---|
| 0 | Conservative Spenders | ₹829 | 162 |
| 1 | High-Value Users | ₹1,692 | 146 |
| 2 | Frequent Small Transactions | ₹657 | 227 |
| 3 | Active Users | ₹986 | 267 |
| 4 | Balanced Spenders | ₹1,208 | 198 |
Top factors influencing recommendations:
- Transaction Category (53.6%)
- Amount Variability (15.8%)
- Day of Month (3.7%)
- User History Length (3.5%)
- Median Amount (3.3%)
POST /recommend
{
"user_id": "USER_0001",
"category": "Food & Dining",
"location": "Mumbai",
"payment_method": "PhonePe",
"hour": 13
}GET /user-insights/{user_id}- Algorithm: Random Forest Regression
- Features: 15 engineered features
- Performance: 59.5% variance explained
- Speed: Sub-second inference
- Scalability: Handles 1000+ users efficiently
- Improved UX: Reduces amount entry friction
- Increased Engagement: Personalized experience
- Fraud Prevention: Anomaly detection capabilities
- Data Insights: User behavior analytics
- Deep learning models for complex patterns
- Real-time model updates
- A/B testing framework
- Mobile app integration
- Advanced fraud detection
This project is licensed under the MIT License.
Built with ❤️ for the fintech community