{"id":25077719,"url":"https://github.com/dagiteferi/credit-scoring-model","last_synced_at":"2025-07-16T15:35:03.721Z","repository":{"id":273743930,"uuid":"920730012","full_name":"dagiteferi/Credit-scoring-model","owner":"dagiteferi","description":"Developing a comprehensive and effective credit scoring model for Bati Bank, leveraging data from an eCommerce platform to enable a buy-now-pay-later service for customers. This project involves understanding credit scoring methodologies, exploratory data analysis (EDA), feature engineering, model training and evaluation, and API development for re","archived":false,"fork":false,"pushed_at":"2025-03-11T21:37:31.000Z","size":3662,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T00:48:16.291Z","etag":null,"topics":["credit-scoring","fastapi","mlops"],"latest_commit_sha":null,"homepage":"https://credit-scoring-frontend.onrender.com/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dagiteferi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-22T17:14:22.000Z","updated_at":"2025-03-11T21:31:46.000Z","dependencies_parsed_at":"2025-03-06T09:29:56.508Z","dependency_job_id":null,"html_url":"https://github.com/dagiteferi/Credit-scoring-model","commit_stats":null,"previous_names":["dagiteferi/credit-scoring-model"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagiteferi%2FCredit-scoring-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagiteferi%2FCredit-scoring-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagiteferi%2FCredit-scoring-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagiteferi%2FCredit-scoring-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagiteferi","download_url":"https://codeload.github.com/dagiteferi/Credit-scoring-model/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253786225,"owners_count":21964117,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["credit-scoring","fastapi","mlops"],"created_at":"2025-02-07T02:35:50.247Z","updated_at":"2025-05-12T17:27:00.002Z","avatar_url":"https://github.com/dagiteferi.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Credit Scoring Model for Bati Bank\r\n\r\n![Credit Scoring Banner](https://via.placeholder.com/1200x300.png?text=Credit+Scoring+Model+for+Bati+Bank)  \r\n*Empowering Financial Inclusion with AI-Driven Credit Risk Assessment*\r\n\r\n---\r\n\r\n## 📖 Table of Contents\r\n\r\n- [Introduction](#introduction)\r\n- [✨ Features](#-features)\r\n- [📂 Project Structure](#-project-structure)\r\n- [⚙️ Installation](#️-installation)\r\n- [🚀 Usage](#-usage)\r\n  - [Running the Backend](#running-the-backend)\r\n  - [Using the Frontend](#using-the-frontend)\r\n  - [Making API Predictions](#making-api-predictions)\r\n- [🔍 Exploratory Data Analysis (EDA)](#-exploratory-data-analysis-eda)\r\n- [🛠️ Feature Engineering](#️-feature-engineering)\r\n- [🤖 Model Training and Evaluation](#-model-training-and-evaluation)\r\n- [🔮 Model Explainability](#-model-explainability)\r\n- [🌐 API Development](#-api-development)\r\n- [💻 Frontend Interface](#-frontend-interface)\r\n- [🚀 Deployment](#-deployment)\r\n- [🎯 Challenges and Solutions](#-challenges-and-solutions)\r\n- [🔮 Future Work](#-future-work)\r\n- [🤝 Contributing](#-contributing)\r\n\r\n\r\n---\r\n\r\n## Introduction\r\n\r\nThe **Credit Scoring Model for Bati Bank** is an AI-powered platform designed to assess credit risk using eCommerce transaction data. This solution enables financial inclusion through:\r\n\r\n- **📈 Accurate Predictions**: Random Forest model achieves **ROC-AUC: 0.9998**\r\n- **🔍 Transparent Decisions**: SHAP explanations and feature importance visualizations\r\n- **⚡ Real-Time Processing**: FastAPI backend with \u003c100ms response times\r\n- **📱 Mobile-First Interface**: Responsive design accessible on all devices\r\n\r\n---\r\n\r\n## ✨ Features\r\n\r\n- **Automated Data Pipelines**\r\n  - RFMS scoring (Recency, Frequency, Monetary, Score)\r\n  - WoE encoding for categorical features\r\n- **Advanced Modeling**\r\n  - Hyperparameter-tuned Random Forest \u0026 Logistic Regression\r\n  - Cross-validation with stratified sampling\r\n- **Production-Ready Deployment**\r\n  - Dockerized environment\r\n  - CI/CD pipeline with GitHub Actions\r\n- **User-Centric Interface**\r\n  - Dual form system (Quick/Detailed assessment)\r\n  - Interactive risk visualization dashboard\r\n\r\n---\r\n\r\n## 📂 Project Structure\r\n\r\n~~~bash\r\ndagiteferi-credit-scoring-model/\r\n├── 📁 credit_scoring_app/       # FastAPI backend\r\n├── 📁 models/                   # Serialized ML models\r\n├── 📁 notebooks/                # Jupyter analysis notebooks\r\n├── 📁 scripts/                  # Data processing scripts\r\n├── 📁 static/                   # CSS/JS assets\r\n└── 📁 tests/                    # Unit/integration tests\r\n~~~\r\n\r\n---\r\n\r\n## ⚙️ Installation\r\n\r\n```bash\r\ngit clone https://github.com/your-repo/dagiteferi-credit-scoring-model.git\r\ncd dagiteferi-credit-scoring-model\r\npython3 -m venv venv\r\nsource venv/bin/activate  # Linux/Mac\r\nvenv\\Scripts\\activate     # Windows\r\npip install -r requirements.txt\r\n\r\n## 🚀 Usage\r\n\r\n### Running the Backend\r\n```bash\r\ncd credit_scoring_app\r\nuvicorn main:app --host 0.0.0.0 --port 8000\r\n```\r\n### Using the Frontend\r\nAccess at http://localhost:8000/static/index.html\r\n\r\n![image](https://github.com/user-attachments/assets/6cfda001-0733-40d2-80a7-6a0b1f563268)\r\n#### Making API Predictions\r\n```bash\r\ncurl -X POST \"http://localhost:8000/predict/good\" \\\r\n-H \"Content-Type: application/json\" \\\r\n-d '{\r\n  \"TransactionId\": 1,\r\n  \"Amount\": 0.05,\r\n  \"FraudResult\": 0\r\n}'\r\n```\r\n## 🔍 Exploratory Data Analysis (EDA)\r\n\r\n**Key Insights:**  \r\n- 🎯 **Class Imbalance**: Only 0.2% fraud cases  \r\n- 📉 **Skewed Distributions**: Transaction amounts follow power law  \r\n- 🔗 **Strong Correlations**:  \r\n  - `RFMS_score` ↔ `Total_Transaction_Amount` (ρ=0.89)  \r\n  - `Transaction_Count` ↔ `Product_Variety` (ρ=0.76)  \r\n\r\n---\r\n\r\n## 🛠️ Feature Engineering\r\n\r\n**Transformations Applied:**  \r\n1. **Temporal Features**  \r\n   - Transaction hour/day/month  \r\n   - Time since last transaction  \r\n2. **Aggregate Features**  \r\n   - 30-day rolling transaction count  \r\n   - Customer lifetime value  \r\n\r\n---\r\n\r\n## 🤖 Model Training and Evaluation\r\n\r\n| Model               | ROC-AUC | Precision | Recall | F1-Score |\r\n|---------------------|---------|-----------|--------|----------|\r\n| Random Forest       | 0.9998  | 0.997     | 0.998  | 0.997    |\r\n| Logistic Regression | 0.9962  | 0.982     | 0.961  | 0.971    |\r\n\r\n---\r\n\r\n## 🔮 Model Explainability\r\n\r\n**SHAP Analysis:**  \r\n- **Top Predictive Features**:  \r\n  1. `Total_Transaction_Amount` (SHAP value: 1.42)  \r\n  2. `RFMS_score` (SHAP value: 1.18)  \r\n  3. `Transaction_Recency` (SHAP value: 0.76)  \r\n\r\n---\r\n\r\n## 🌐 API Development\r\n\r\n**Endpoints:**  \r\n```python\r\n@app.post(\"/predict/good\")\r\nasync def predict_good_risk(data: CustomerData):\r\n    return predict(data, model_path=\"models/RandomForest_best_model.pkl\")\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagiteferi%2Fcredit-scoring-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagiteferi%2Fcredit-scoring-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagiteferi%2Fcredit-scoring-model/lists"}