Spaces:
Paused
Paused
Download app/fine_tuning/evaluate.py from tenperformer/Matchlens-API: direct link, hf CLI and curl.
- Browser
- Download file 422 Bytes
-
https://huggingface.co/spaces/tenperformer/Matchlens-API/resolve/main/app/fine_tuning/evaluate.py
- Command line
-
hf download hf://spaces/tenperformer/Matchlens-API/app/fine_tuning/evaluate.py
-
curl -L -o evaluate.py https://huggingface.co/spaces/tenperformer/Matchlens-API/resolve/main/app/fine_tuning/evaluate.py
422 Bytes
| """Evaluate a trained classifier without fabricating metrics.""" | |
| from sklearn.metrics import accuracy_score, confusion_matrix, f1_score | |
| def metrics(expected: list[int], predicted: list[int]) -> dict: | |
| return { | |
| "accuracy": accuracy_score(expected, predicted), | |
| "macro_f1": f1_score(expected, predicted, average="macro"), | |
| "confusion_matrix": confusion_matrix(expected, predicted).tolist(), | |
| } | |