Skip to main content

A family of metrics for principled evaluation of uncertainty-augmented systems

Project description

ECUAS: Expected Cost for Uncertainty-Augmented Systems

ecuas is a Python library containing popular calibration and classification evaluation metrics, alongside the principled ECUAS metric family, for Uncertainty-Augmented (UA) systems.

This library implements the ECUAS_n metric family described in the paper: ECUAS_n: A family of metrics for principled evaluation of uncertainty-augmented systems.

Background

In high-stakes automated decision-making, access to predictive uncertainty is essential for enabling users to accept or reject predictions based on application-specific cost trade-offs.

Traditional evaluation approaches assess these systems using separate metrics for candidate predictions (e.g., accuracy) and uncertainty scores (e.g., AUC, ECE, Brier Score), or by integrating over risk-coverage curves (e.g., AURC) that ignore probabilistically interpretable uncertainties.

ECUAS solves this by providing a unified, decision-theory-based proper scoring rule (PSR) to comprehensively evaluate the task of interest. The parameter $n$ controls the trade-off between the cost of incorrect predictions and imperfect uncertainties:

  • A small value (e.g., $n=0$) heavily penalizes systems that give high confidence to incorrect answers, suitable for settings where accepting an incorrect answer has severe consequences.
  • A large value (e.g., $n \rightarrow \infty$) acts more like the 0-1 cost error rate, giving milder penalties to confident-but-incorrect predictions.

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 (e.g., n=0 to heavily penalize overconfident errors)
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecuas-0.1.2.tar.gz (67.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecuas-0.1.2-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file ecuas-0.1.2.tar.gz.

File metadata

  • Download URL: ecuas-0.1.2.tar.gz
  • Upload date:
  • Size: 67.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for ecuas-0.1.2.tar.gz
Algorithm Hash digest
SHA256 15da784bb7fd6d944da386ed8580f7d2636b71ec41e5dda69ea22155b0f146ec
MD5 a1a9d02bd64a8e1a96f6da157707d9af
BLAKE2b-256 3154c95aeb67a90042a84fba0a79fbf380a328b0afda42a75bf0198887482743

See more details on using hashes here.

File details

Details for the file ecuas-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ecuas-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.3

File hashes

Hashes for ecuas-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d1e97b9ae6add848dcda5c7818ae70d5b3825ce4a1ffc32edc2648422ad4593f
MD5 c2496a8f06fe4132dc843728cfe74448
BLAKE2b-256 ba2290b5c931804f7d9aa48e8b4cdaf39837dc1040502c588400130441c10c39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page