$115.00
1. Introduction
AI-based credit scoring is now being adopted not only by financial institutions, but also by a variety of organizations, including startups and local governments.
This article introduces the entire process of a homemade scoring system, from building an AI model using LightGBM, ensuring interpretability using SHAP values, and creating a web app using Flask.
It is structured for implementation from an engineer's perspective, and the entire code set has been published on GitHub.
For more information, please visit:
https://www.urata-soft.org/ai-product
For product-related questions or other inquiries, please feel free to contact us using this support form.
https://www.urata-soft.org/product
Japanese Patent Application No. 2025-137163
2. Training Process and Implementing Interpretability Using SHAP
LightGBM (LGBMClassifier) is used for training, and the objective variable is the delinquency flag (Delinquency = 1 or 0).
Variable selection and encoding are centralized in train_model.py.
Dynamic variable generation is implemented by calculating the borrowing ratio (BorrowingRatio).
The top three features that influenced the prediction for each individual are displayed using the SHAP value.
Accuracy evaluation calculates both accuracy and AUC scores to provide a balanced assessment of model performance.
3. Visualizing Scores with a Web App
Launch webapp.py to display scores in a browser.
Display scores between 0 and 1 in the Score column.
Scores above 0.7 are highlighted in red (high risk).
Decoding allows categorical variables to be displayed with their original labels.
This configuration allows field personnel to visually confirm the evaluation, facilitating smooth implementation.
4. System Overview
The system is configured as follows:
Data preprocessing and training: train_model.py
Web score display app: webapp.py
Trained model: model.pkl
Feature mapping: cat_maps.pkl
Result output: individual_scores.csv
Data to display: input.csv