Reportes de evaluación (clasificación/regresión) a Markdown con gráficos
Project description
evalcards
Descripción
evalcards genera reportes de evaluación para modelos supervisados en Markdown, con gráficos listos. Soporta:
- Clasificación (binaria y multiclase OvR)
- Regresión
- Forecasting (sMAPE/MASE)
Características
- Tabla de métricas por tarea.
- Gráficos: matriz de confusión, ROC/PR (binaria y multiclase OvR), ajuste y residuales.
- CLI y API Python.
- Carpeta de salida por defecto:
./evalcards_reports(personalizable con--outdir).
Requisitos
- Python 3.9+
- Dependencias se instalan automáticamente (numpy, pandas, scikit-learn, matplotlib, jinja2).
Instalación (dev/local)
- Crear y activar entorno virtual (opcional):
- Windows (PowerShell):
python -m venv .venv . .\.venv\Scripts\Activate.ps1
- macOS / Linux:
python3 -m venv .venv source .venv/bin/activate
- Windows (PowerShell):
- Instalar en modo editable desde la carpeta del proyecto:
pip install -e .
Uso rápido (API Python)
Clasificación binaria (con probabilidades opcionales):
from evalcards import make_report
path = make_report(
y_true, y_pred, y_proba=proba, # y_proba: vector 1D (prob. clase positiva)
path="reporte.md", title="Mi modelo"
)
print(path)
Regresión:
make_report(y_true, y_pred, path="rep_reg.md", title="Regresión")
Uso rápido (CLI)
- Prepara CSVs con una sola columna o con nombres estándar (
y_true,y_pred,y_proba). - Ejecuta (por defecto guarda en
./evalcards_reports):evalcards --y_true y_true.csv --y_pred y_pred.csv --proba y_proba.csv --out rep.md --title "Mi modelo"
- Carpeta personalizada:
evalcards --y_true y_true.csv --y_pred y_pred.csv --out rep.md --outdir informes_eval
Clasificación multiclase (OvR)
API (Python)
# y_proba: matriz (n_samples, n_classes) con probabilidades
out = make_report(
y_true, y_pred, y_proba=proba,
labels=["Clase_A","Clase_B","Clase_C"], # opcional
path="rep_multi.md", title="Multiclase OvR"
)
CLI
# y_proba.csv con N columnas (una por clase)
evalcards --y_true y_true.csv --y_pred y_pred.csv --proba y_proba.csv --class-names "Clase_A,Clase_B,Clase_C" --out rep_cli_multiclase.md
Salidas: confusion.png + roc_class_<clase>.png y pr_class_<clase>.png por clase.
Métrica: roc_auc_ovr_macro.
Forecasting (sMAPE/MASE)
API (Python)
out = make_report(
y_true_test, y_pred_test,
task="forecast", season=12, insample=y_true_train,
path="rep_forecast.md", title="Forecast"
)
CLI
evalcards --y_true y_true_test.csv --y_pred y_pred_test.csv --forecast --season 12 --insample y_insample.csv --out rep_forecast_cli.md
Métricas: MAE, MSE, RMSE, sMAPE (%), MASE.
Gráficos: fit.png y resid.png.
Entradas esperadas
- Clasificación:
y_true: etiquetas reales (0..K-1 o nombres).y_pred: etiquetas predichas.y_proba:- Binaria: vector 1D (prob. clase positiva).
- Multiclase: matriz (N columnas, una por clase).
- Regresión/Forecast:
y_true: valores reales.y_pred: valores predichos.insample(opcional para MASE): serie de entrenamiento; usar--season(ej. 12).
Salidas
- Archivo Markdown con métricas y referencias a imágenes.
- Imágenes PNG en la carpeta destino (por defecto:
./evalcards_reports):- Clasificación:
confusion.png; si hay probabilidades binaria:roc.png,pr.png; en multiclase:roc_class_<clase>.pngypr_class_<clase>.pngpor clase. - Regresión/Forecast:
fit.png(ajuste y vs ŷ) yresid.png(residuales).
- Clasificación:
Métricas incluidas
- Clasificación:
accuracy,precision/recall/F1(macro y weighted).- Binaria:
roc_auc. - Multiclase OvR:
roc_auc_ovr_macro.
- Binaria:
- Regresión:
MAE,MSE,RMSE,R². - Forecast:
MAE,MSE,RMSE,sMAPE (%),MASE.
Notas técnicas
- Si solo pasas un nombre de archivo en
--out/path(p. ej.rep.md), se usará./evalcards_reportsautomáticamente. - Si especificas una ruta con carpeta, se respeta esa ruta.
--outdirfija explícitamente la carpeta de salida.- El paquete fuerza backend Agg de Matplotlib para generar PNGs en entornos sin GUI.
Solución de problemas (rápida)
- “No module named evalcards”: instala con
pip install -e .desde la carpeta del proyecto y activa tu venv. - Matplotlib/Tk en servidores: no se necesita GUI; se guardan PNGs con backend
Agg. - CSVs: si el archivo tiene varias columnas, usa nombres
y_true/y_pred/y_probao deja una sola columna.
Soporte actual
- Detección automática de tarea (
auto): clasificación vs regresión. - Multiclase: curvas ROC/PR OvR y
roc_auc_ovr_macro. - Forecasting: sMAPE/MASE con
--seasone--insample.
Licencia
MIT
Autor
Ricardo Urdaneta (Ricardouchub)
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 evalcards-0.2.6.tar.gz.
File metadata
- Download URL: evalcards-0.2.6.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
349c692387704f9dd4713d059eafb1477e4d5f1d10f3f8cf641f56968b5bf656
|
|
| MD5 |
7febb28f51e8f825093bd00e812e341f
|
|
| BLAKE2b-256 |
64f2cdf4dda610eb66990eca3acd430e9922c12a47f05682f30c58d47ec993ca
|
Provenance
The following attestation bundles were made for evalcards-0.2.6.tar.gz:
Publisher:
release.yml on Ricardouchub/evalcards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evalcards-0.2.6.tar.gz -
Subject digest:
349c692387704f9dd4713d059eafb1477e4d5f1d10f3f8cf641f56968b5bf656 - Sigstore transparency entry: 452856411
- Sigstore integration time:
-
Permalink:
Ricardouchub/evalcards@d8426c9c06f757b95aa14d3c61c73650c88bf699 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/Ricardouchub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8426c9c06f757b95aa14d3c61c73650c88bf699 -
Trigger Event:
push
-
Statement type:
File details
Details for the file evalcards-0.2.6-py3-none-any.whl.
File metadata
- Download URL: evalcards-0.2.6-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e1087f7fa140b67452827740a4eb4e89af2ed3895b41496bdeb9b61ffe6217b
|
|
| MD5 |
9b7473cc3c29024731f84ca68a6de760
|
|
| BLAKE2b-256 |
658211d906c7697c9df870d558d4ae44f01f87ddea733d2a827c579c66f30972
|
Provenance
The following attestation bundles were made for evalcards-0.2.6-py3-none-any.whl:
Publisher:
release.yml on Ricardouchub/evalcards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
evalcards-0.2.6-py3-none-any.whl -
Subject digest:
7e1087f7fa140b67452827740a4eb4e89af2ed3895b41496bdeb9b61ffe6217b - Sigstore transparency entry: 452856413
- Sigstore integration time:
-
Permalink:
Ricardouchub/evalcards@d8426c9c06f757b95aa14d3c61c73650c88bf699 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/Ricardouchub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d8426c9c06f757b95aa14d3c61c73650c88bf699 -
Trigger Event:
push
-
Statement type: