Feature selection and model monitoring toolkit for credit and risk modeling.
Project description
🚀 model-track-cr
Read this in other languages: English, Português
model-track-cr is a professional Python toolkit designed to structure, standardize, and operationalize the full statistical and machine learning modeling workflow.
It is purpose-built for credit, risk, and supervised modeling (Binary, Multiclass, and Regression). Instead of fragmented notebooks, model-track-cr provides cohesive, Pandas-first components that work seamlessly together—from data diagnostic to model deployment.
📦 Installation
Install via pip:
pip install model-track-cr
For advanced features (like Bayesian Tuning and LightGBM support):
pip install "model-track-cr[tuning]"
⚡ Quickstart
Here's how easy it is to build a full feature engineering pipeline:
import pandas as pd
from model_track.preprocessing import DataOptimizer
from model_track.binning import TreeBinner
from model_track.woe import WoeCalculator
from model_track.stats import StatisticalSelector
# 1. Optimize memory
df = DataOptimizer.reduce_mem_usage(df)
# 2. Supervised Binning
binner = TreeBinner(max_depth=3)
binner.fit(df, column="feature", target="target")
df["feature_binned"] = binner.transform(df, column="feature")
# 3. Weight of Evidence (WoE) Transformation
woe_calc = WoeCalculator()
woe_calc.fit(df, target="target", columns=["feature_binned"])
df_woe = woe_calc.transform(df, columns=["feature_binned"])
# 4. Feature Selection (Information Value & Cramer's V)
selector = StatisticalSelector(iv_threshold=0.02)
selector.fit(df_woe, target="target", features=["feature_binned"])
df_selected = selector.transform(df_woe)
🛠️ Core Capabilities
- 📊 Diagnostics & Optimization: Memory reduction (
DataOptimizer), missing value auditing (DataAuditor), and data schema extraction. - 🪜 Binning: Supervised (
TreeBinner) and Unsupervised (QuantileBinner) binning strategies. - 🧮 WoE & IV: Weight of Evidence calculators (
WoeCalculator) and Information Value adapters for Binary, Multiclass, and Regression tasks. - 🎯 Feature Selection: Automated selection using IV, Variance, Spearman correlation, and Cramer's V (
StatisticalSelector,RegressionSelector,MulticlassSelector). - 📈 Stability Monitoring: Population Stability Index (PSI) and Temporal WoE stability matrices (
WoeStability) to track data drift. - 🧠 Hyperparameter Tuning: Model-agnostic Bayesian optimization with built-in LightGBM presets (
BayesianTuner,LGBMTuner). - 📏 Evaluation: Standardized metrics and reports for all task types.
- 💾 Project Context: Serialize your entire pipeline (bins, WoE maps, metadata) for production deployment (
ProjectContext).
📓 Example Notebooks
Want to see it in action? Check out our end-to-end examples:
- Multiclass Pipeline (Wine Dataset): Binning →
MulticlassSelector→OvRWoeAdapter→ LightGBM → Evaluation. - Regression Pipeline (California Housing): Audit →
RegressionSelector→ LightGBM → Stability Report.
🧩 Architecture & Philosophy
The library is built around a Pandas-first philosophy, where every component follows a fit/transform interface but expects and returns Pandas DataFrames. This ensures metadata (like column names) is preserved throughout the pipeline.
classDiagram
BaseTransformer <|-- TreeBinner
BaseTransformer <|-- WoeCalculator
BaseTransformer <|-- StatisticalSelector
class BaseTransformer {
<<abstract>>
+fit(df, target)
+transform(df)
}
🤝 Contributing
The project follows strict Test-Driven Development (TDD) with 100% coverage.
See CONTRIBUTING.md and AGENTS.md for local setup and Gitflow guidelines.
📄 License
MIT License
Project details
Release history Release notifications | RSS feed
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 model_track_cr-1.1.1.tar.gz.
File metadata
- Download URL: model_track_cr-1.1.1.tar.gz
- Upload date:
- Size: 35.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.0 CPython/3.13.13 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1ee6312b203c1b80fe54e2b24aace80b562393481050d34d537e5c1eaafbbdd
|
|
| MD5 |
e8e626b3923e157c1b3baf990f120a3c
|
|
| BLAKE2b-256 |
359188bbaaa3a8a60d8dae7c9410cbd0b4d421e0512502f8b46cf91bbcaa7a55
|
File details
Details for the file model_track_cr-1.1.1-py3-none-any.whl.
File metadata
- Download URL: model_track_cr-1.1.1-py3-none-any.whl
- Upload date:
- Size: 50.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.0 CPython/3.13.13 Linux/6.17.0-1010-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03d85d65bd1583937088b48ebe257b94b5a21e056c3a90b0d01fec7fe98d17c6
|
|
| MD5 |
fde153a74f1f941f0ae523524328d5b7
|
|
| BLAKE2b-256 |
e8c7b0141635feefb3c18e8660e365d87cabfd94fc78bcae69d57789bd9c9970
|