Skip to main content

🚀 model-track-cr

PyPI version Python versions License: MIT

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:


🧩 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

Metadata

Release files for model-track-cr 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for model-track-cr 1.1.1
File Size Uploaded Provenance Actions
model_track_cr-1.1.1.tar.gz 35.4 kB Without provenance Details for model_track_cr-1.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for model-track-cr 1.1.1
File Interpreter ABI Platform Actions
model_track_cr-1.1.1-py3-none-any.whl Python 3 none any Details for model_track_cr-1.1.1-py3-none-any.whl

Total release size: 85.8 kB

Release files / model_track_cr-1.1.1.tar.gz

Download URL model_track_cr-1.1.1.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1ee6312b203c1b80fe54e2b24aace80b562393481050d34d537e5c1eaafbbdd
BLAKE2b-256 checksum
How to use checksums
359188bbaaa3a8a60d8dae7c9410cbd0b4d421e0512502f8b46cf91bbcaa7a55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.13.13 Linux/6.17.0-1010-azure

Release files / model_track_cr-1.1.1-py3-none-any.whl

Download URL model_track_cr-1.1.1-py3-none-any.whl
Size 50.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03d85d65bd1583937088b48ebe257b94b5a21e056c3a90b0d01fec7fe98d17c6
BLAKE2b-256 checksum
How to use checksums
e8c7b0141635feefb3c18e8660e365d87cabfd94fc78bcae69d57789bd9c9970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.13.13 Linux/6.17.0-1010-azure

Security for model-track-cr 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page