ua-metrics
ua-metrics is a Python package for standard and uncertainty-adjusted regression metrics,
accompanying the paper "Uncertainty-Aware Metrics for Evaluating Machine Learning Regression
Models in Materials Testing".
The package provides three uncertainty-model modules:
ua_metrics.gaussianua_metrics.student_tua_metrics.lognormal
Features
- Standard regression metrics.
- Uncertainty-adjusted regression metrics.
- Gaussian, Student-t, and lognormal uncertainty models.
- Heteroscedastic and homoscedastic uncertainty handling.
- A consistent module-based API.
Installation
pip install ua-metrics
Quick start
from ua_metrics import gaussian as gau
from ua_metrics import lognormal as logn
from ua_metrics import student_t as t
Default behavior (heteroscedastic uncertainty, mean scaling) and its equivalent explicit form:
v1 = gau.mae_ua([100, 110, 95], [102, 108, 97], 5.0)
v2 = gau.rmse_ua(
[100, 110, 95],
[102, 108, 97],
5.0,
mode="hetero",
scale="mean",
)
Homoscedastic uncertainty with a constant absolute standard deviation:
v3 = gau.mae_ua([100, 110, 95], [102, 108, 97], 1.0, mode="homo")
Student-t and lognormal uncertainty models:
v4 = t.mae_ua([100, 110, 95], [102, 108, 97], 7.5, df=3.0)
v5 = logn.mae_ua([100, 110, 95], [102, 108, 97], 12.0)
Package structure
Standard metrics
from ua_metrics import mae, median_absolute_error, mse, rmse
from ua_metrics import mape, smape, r2_score, adjusted_r2_score
Uncertainty-adjusted metrics
from ua_metrics import gaussian as gau
from ua_metrics import student_t as t
from ua_metrics import lognormal as logn
Each uncertainty module provides:
mae_uamedian_absolute_error_uamse_uarmse_uamape_uasmape_uar2_score_uaadjusted_r2_score_ua
Interface
All uncertainty-adjusted metrics use the same public interface:
metric_ua(y_obs, y_pred, value, *, mode="hetero", scale="mean", ...)
Argument semantics
valuewithmode="hetero"is interpreted as CV percent of uncertainty.valuewithmode="homo"is interpreted as a constant absolute uncertainty standard deviation.
Default behavior
The default configuration is:
mode="hetero"scale="mean"
Under this default, value=5.0 means the uncertainty standard deviation is 5% of the observation-wise mean scale.
Scale definitions
Supported scale values are:
"mean", defined as0.5 * (y_obs + y_pred)"y_obs""y_pred"
Notes
- Values greater than 100 are allowed in heteroscedastic mode.
- Homoscedastic mode expects a scalar constant absolute uncertainty value.
Citation
If you use ua-metrics in your work, please cite the accompanying paper (accepted for
publication in Measurement, in press — volume/pages/DOI to be added once assigned) and/or
the software itself. Machine-readable citation metadata is kept up to date in
CITATION.cff.
@article{abbas_ua_metrics_paper,
title = {Uncertainty-Aware Metrics for Evaluating Machine Learning Regression Models in Materials Testing},
author = {Abbas, Mohammad and Zaumanis, Martins},
journal = {Measurement},
year = {2026},
note = {Accepted, in press. Full citation to be updated once volume/pages/DOI are assigned.}
}
@software{abbas_ua_metrics_software,
title = {ua-metrics},
author = {Abbas, Mohammad},
year = {2026},
version = {1.0.0},
url = {https://github.com/Moha-Abbas/ua-metrics}
}
License
MIT — see LICENSE.
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 ua_metrics-1.0.0.tar.gz.
File metadata
- Download URL: ua_metrics-1.0.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f8785ae505e9722928685702878ffa558487f06aa2408daf6083e9d11723b64
|
|
| MD5 |
0a2fd9bd5544a7b349b55f24c44bcb48
|
|
| BLAKE2b-256 |
6ada0d52697622eb357d497977643fe4f6298d2c73524dd8c6ac3dc5b4c3dfe4
|
Provenance
The following attestation bundles were made for ua_metrics-1.0.0.tar.gz:
Publisher:
publish.yml on Moha-Abbas/ua-metrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ua_metrics-1.0.0.tar.gz -
Subject digest:
6f8785ae505e9722928685702878ffa558487f06aa2408daf6083e9d11723b64 - Sigstore transparency entry: 2502128127
- Sigstore integration time:
-
Permalink:
Moha-Abbas/ua-metrics@8f9c58d06266678f050e4e1816a7e031df30c707 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Moha-Abbas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8f9c58d06266678f050e4e1816a7e031df30c707 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ua_metrics-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ua_metrics-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcbc682e5af0accd42fa2b46cc186e797b85bbb7509dda29599bf57dea51b01a
|
|
| MD5 |
3bf442117b74ba085c16fff3af8eb691
|
|
| BLAKE2b-256 |
96d8ddcfc7a4396c59137125353e1c57cf11c1ac9793f845a6af118a9107b2d9
|
Provenance
The following attestation bundles were made for ua_metrics-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Moha-Abbas/ua-metrics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ua_metrics-1.0.0-py3-none-any.whl -
Subject digest:
dcbc682e5af0accd42fa2b46cc186e797b85bbb7509dda29599bf57dea51b01a - Sigstore transparency entry: 2502128236
- Sigstore integration time:
-
Permalink:
Moha-Abbas/ua-metrics@8f9c58d06266678f050e4e1816a7e031df30c707 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Moha-Abbas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8f9c58d06266678f050e4e1816a7e031df30c707 -
Trigger Event:
release
-
Statement type: