A comprehensive automated credit risk scorecard modeling library
Project description
AutoScore
AutoScore is a comprehensive, automated Python library for building Credit Risk Scorecards. It streamlines the entire modeling lifecycle—from Exploratory Data Analysis (EDA) and Feature Engineering to Model Training, Evaluation, and Scorecard Generation—making it easy to develop professional-grade credit scoring models with minimal code.
🚀 Key Features
- End-to-End Automation: One-line
fit()to go from raw data to a production-ready scorecard. - Intelligent Binning:
- ChiMerge algorithm with automatic trend detection.
- Monotonicity Constraints: Enforce strictly increasing/decreasing bad rates.
- Visual Adjustment: Interactive plots to manually fine-tune bins.
- Robust Feature Selection:
- IV (Information Value) filtering.
- Stepwise Logistic Regression (optimized for convergence).
- Advanced Evaluation:
- PSI (Population Stability Index) calculation for Train, Test, and OOT (Out-of-Time) datasets.
- AUC, KS statistics.
- Production Ready:
- Standard Scorecard format export (Excel).
- Model persistence (save/load).
- OOT sample splitting support.
📦 Installation
pip install autoscore
⚡ Quick Start
1. Standard Pipeline
import pandas as pd
from autoscore import AutoScore
# Load your dataset
df = pd.read_csv('german_credit_data.csv')
# Initialize AutoScore
score = AutoScore(random_state=42)
# Fit the model
score.fit(
X=df.drop(columns=['target']),
y=df['target'],
test_size=0.3,
selection_method='stepwise',
iv_threshold=0.02,
max_bins=5,
pdo=20, base_score=600, base_odds=50
)
# Generate Excel Report
score.create_report('scorecard_report.xlsx')
2. Advanced Usage: OOT Split & Constraints
# Define Monotonicity Constraints
# 1: Increasing Risk, -1: Decreasing Risk, 0: Auto
constraints = {
'duration': 1,
'age': -1
}
score.fit(
X=df.drop(columns=['target']),
y=df['target'],
date_col='create_time', # Column for time-based split
oot_split_date='2023-10-01', # Date to split OOT
monotonicity_constraints=constraints
)
3. Visual Binning Adjustment
Visualize the binning results and adjust rules manually if needed.
# Visualize 'duration' binning
score.visualize_binning('duration', filename='duration_plot.png')
# Manually adjust cutoffs
new_rules = {
'duration': {'cutoffs': [12, 24, 36]}
}
score.adjust_rules(new_rules, X_train, y_train)
4. Standalone Components
You can use specific modules independently.
from autoscore import BinningProcess
# Independent Binning
binning = BinningProcess(max_bins=5)
binning.fit(X, y)
X_woe = binning.transform(X)
📊 Report Output
The generated scorecard_report.xlsx includes:
- Summary: Data shape, target distribution.
- IV Analysis: Information Value for all features.
- Model Performance: AUC, KS, PSI for Train/Test/OOT.
- Scorecard: The final points table for implementation.
- Model Coefficients: Logistic Regression weights.
🛠 Dependencies
- pandas
- numpy
- scikit-learn
- matplotlib
- openpyxl
- joblib
📄 License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autoscore-0.1.0.tar.gz.
File metadata
- Download URL: autoscore-0.1.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7fee735052d31c9e9db245c00b9caf15c50271cc859b78555aebf3bffdcc5d6
|
|
| MD5 |
57a1eae2842be93c0c1b8c4d5a079062
|
|
| BLAKE2b-256 |
c008b2ddb78fa71aa861eeed4ba279d70a5cd1c1c8ad60b8491013b14e04bdee
|
File details
Details for the file autoscore-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autoscore-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc177939935b31c4ac6e752f78d044b770bf07dfeecbcc5e207da059a3d1325f
|
|
| MD5 |
437d77fa41fa393829f3de6d3f231c4c
|
|
| BLAKE2b-256 |
e2d6ac5bfb3000bed400bde8f52b6a08fe2a70b20fde24ba917c276ecd7084f3
|