Metadata-Version: 2.4
Name: modelguard-ml
Version: 0.5.0
Summary: Audita modelos de ML: contradições vs regras de negócio, comparação multi-modelo, drift de explicação e fairness — via SHAP
Author: modelguard contributors
License: MIT
Project-URL: Homepage, https://github.com/Rivianee/modelguard
Keywords: machine-learning,explainability,shap,mlops,fairness,drift
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: shap>=0.44.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: scipy>=1.10
Requires-Dist: matplotlib>=3.7
Provides-Extra: mlflow
Requires-Dist: mlflow-skinny>=2.10; extra == "mlflow"
Dynamic: license-file

# 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
```bash
pip install -e .
```

## Uso
```python
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

```python
from modelcheck.rules.rule_learner import RuleLearner
learner = RuleLearner()
learner.to_yaml(learner.learn(X, y), "rules.yaml")
```

## Regras (rules.yaml)
```yaml
rules:
  - feature: price
    expected_direction: negative
    description: "Preço alto reduz venda"
```

## Testes
```bash
pytest tests/
```

## Licença
MIT
