Expected Cost for Uncertainty-Augmented Systems — metrics for evaluating calibration and selective prediction
Project description
ECUAS: Expected Cost for Uncertainty-Augmented Systems
ecuas is a Python library containing robust calibration and classification evaluation metrics for Uncertainty-Augmented systems. It implements expected cost metrics, ECE, Brier Score, Cross Entropy, AUC, CCAS, LogLog, and selective prediction metrics under a unified torchmetrics.Metric interface.
Installation
Via uv (Recommended)
Add ecuas directly to your project:
uv add ecuas
Via pip
You can install ecuas from PyPI:
pip install ecuas
Features and Metrics
Confidence/Selective Prediction Metrics
- Expected Calibration Error (ECE):
ExpectedCalibrationError - Confidence Error Rate:
ConfidenceErrorRate - Confidence AUC Score:
ConfidenceAUCScore - Confidence Brier Score:
ConfidenceBrierScore - Confidence Cross-Entropy:
ConfidenceCrossEntropy - Confidence ECUAS (n-ECUAS):
ConfidenceECUAS - Confidence Gamma-ECUAS:
ConfidenceGammaECUAS - Confidence AURC:
ConfidenceAURC - CCAS (Confidence Cost for Selective Prediction):
CCAS
Classification Metrics
- Classification Error Rate:
ClassificationErrorRate - Classification Cross-Entropy:
ClassificationCrossEntropy - Classification Brier Score:
ClassificationBrierScore - Classification AUC:
ClassificationAUC - Classification ECE:
ClassificationECE - Classification ECUAS:
ClassificationECUAS - Classification LogLog:
ClassificationLogLog - Classification Gamma-ECUAS:
ClassificationGammaECUAS - Classification AURC:
ClassificationAURC
Usage Example
import torch
from ecuas import ConfidenceECUAS, ExpectedCalibrationError
# Setup data
confidences = torch.tensor([0.9, 0.8, 0.4, 0.9])
correctness = torch.tensor([True, True, False, False])
# Expected Calibration Error
ece_metric = ExpectedCalibrationError(n_bins=10)
ece_metric.update(confidences, correctness)
ece_val = ece_metric.compute()
print(f"ECE: {ece_val.item():.4f}")
# Confidence n-ECUAS
ecuas_metric = ConfidenceECUAS(n=0)
ecuas_metric.update(confidences, correctness)
ecuas_val = ecuas_metric.compute()
print(f"ECUAS (n=0): {ecuas_val.item():.4f}")
Running Tests
Execute the unit test suite:
uv run pytest
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
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 ecuas-0.1.0.tar.gz.
File metadata
- Download URL: ecuas-0.1.0.tar.gz
- Upload date:
- Size: 67.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c247e2a71200d0ca5c57315c992190b4f5eada9aba68bab96ee06d05d392478
|
|
| MD5 |
66add3cdca81a4bc8ef88b4494e0e84b
|
|
| BLAKE2b-256 |
fc92a52a8adf5b9d8889b85f06876af8ddf1fd05fe1e0b2bfebf4e3c5de4154d
|
File details
Details for the file ecuas-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ecuas-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f54aadc3180e1c2b7c3f18b262e9730a369b49e3e2b76b47d3b3f65335650ea9
|
|
| MD5 |
f382d5aff37155375e74aedf88cb8e5b
|
|
| BLAKE2b-256 |
66cd4d8f877a13a9a70c77961c4ce4127ac7ac0be9d37a7ce58e7d59b85a3eae
|