modelcheck
Valida modelos de ML contra regras de negócio, detecta drift de explicação e fairness — tudo via SHAP.
Por quê?
Seu modelo pode ter boa acurácia e ainda assim decidir pelo motivo errado.
Instalação
pip install -e .
Uso
from modelcheck.guard import ModelGuard
from modelcheck.report import summary
guard = ModelGuard(models, X, rules_path="rules.yaml",
sensitive_features=["idade"])
report = guard.run(X)
print(summary(report))
# monitorar drift depois:
report2 = guard.run(X_novo, baseline_snapshots=report["snapshots"])
Features
- Contradições: modelo vs regras de negócio (raro no mercado)
- Comparação multi-modelo: onde XGBoost e LogReg discordam
- Drift de explicação: alerta se o "porquê" das previsões mudou
- Fairness: features sensíveis pesando demais
- RuleLearner: aprende regras dos dados automaticamente
from modelcheck.rules.rule_learner import RuleLearner
learner = RuleLearner()
learner.to_yaml(learner.learn(X, y), "rules.yaml")
Regras (rules.yaml)
rules:
- feature: price
expected_direction: negative
description: "Preço alto reduz venda"
Testes
pytest tests/
Licença
MIT
Release files for modelguard-ml 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| modelguard_ml-0.5.0.tar.gz | 23.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| modelguard_ml-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.2 kB
Release files / modelguard_ml-0.5.0.tar.gz
| Download URL | modelguard_ml-0.5.0.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3497098598440fde1f919def84f0cb7280b6b1bade9928d22c77b8a578b88e81
|
|
BLAKE2b-256 checksum How to use checksums |
45a6d19d634bf7253f696deaefd26ecbcb61f85cb24cf0f1eede5329d06bbe6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / modelguard_ml-0.5.0-py3-none-any.whl
| Download URL | modelguard_ml-0.5.0-py3-none-any.whl |
|---|---|
| Size | 23.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f0c42a65b5b66e002971f65682253c96924c317e6a3d933f2c04335492f3902
|
|
BLAKE2b-256 checksum How to use checksums |
43fc8d530340ede3648e8d7918ee44734c101a5bb50b7fdd51510feced7d017f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|