Skip to main content

aule

Validation metrics and plots for machine learning models, with a focus on earth observation and climate science.

Named after Aulë, the Vala of craft in Tolkien's mythology.

📓 Extensive usage notebooks are available on GitHub.


Install

pip install aule

# optional: geographic basemaps (cartopy)
pip install aule[geo]

# optional: progress bars on heavy loops (tqdm)
pip install aule[progress]

Supported input shapes

aule accepts two families of input, both normalised internally to a single canonical (batch, H, W, C, T) representation.

Spatial family

Shape Meaning
(H, W, C) single spatial field, one channel
(H, W, C, T) spatial field with time axis — pass data_format="hwct"
(batch, H, W, C) batch of spatial fields — pass data_format="bhwc" (default)
(batch, H, W, C, T) full spatio-temporal batch

Series family (pure time series, no spatial extent)

Pass the axes keyword to disambiguate:

Shape axes
(T,) "t"
(C,) "c"
(B, T) "bt"
(C, T) "ct"
(B, C, T) "bct"

Series inputs are promoted to (B, 1, 1, C, T) internally, so every generic metric (RMSE, MAE, Pearson r, …) works directly on them. Functions that genuinely need spatial or temporal extent (SSIM, gradient error, field comparison plots, …) raise a clear error on degenerate inputs; pass force=True to bypass with a warning.


Quick start

import numpy as np
import aule
from aule.metrics import rmse, pearson_r, ssim
from aule.plots import plot_field_comparison, plot_scatter

# ── spatial data ────────────────────────────────────────────────────────────
gt   = np.random.rand(8, 64, 64, 1)
pred = gt + np.random.normal(0, 0.1, gt.shape)

print(rmse(gt, pred))
print(pearson_r(gt, pred))
print(ssim(gt, pred))

fig, axes = plot_field_comparison(gt[0], pred[0])
fig, ax   = plot_scatter(gt, pred)

# ── pure time series ─────────────────────────────────────────────────────────
ts_gt   = np.random.randn(4, 3, 200)   # (B=4, C=3, T=200)
ts_pred = np.roll(ts_gt, 5, axis=-1) + 0.05 * np.random.randn(*ts_gt.shape)

print(rmse(ts_gt, ts_pred, axes="bct"))
print(pearson_r(ts_gt, ts_pred, axes="bct"))

from aule.metrics import lag_correlation, dtw_distance
from aule.plots  import plot_lag_correlation, plot_multi_channel_series

corr = lag_correlation(ts_gt, ts_pred, max_lag=30, axes="bct")
dtw  = dtw_distance(ts_gt, ts_pred, axes="bct")

fig, ax  = plot_lag_correlation(ts_gt, ts_pred, max_lag=30, axes="bct")
fig, axs = plot_multi_channel_series(ts_gt, axes="bct",
                                      channel_names=["Temp", "Precip", "Wind"])

Logging

aule is silent by default. Enable structured, coloured log output with a single call:

import aule
aule.set_log_level("DEBUG")   # DEBUG | INFO | WARNING | ERROR
# or via environment variable before importing:
# AULE_LOG_LEVEL=INFO python my_script.py

Metrics

All importable directly from aule.metrics.

Corermse, mse, mae, bias, pearson_r, ssim, psnr, r2_score, mape, smape, nse, kge, max_error, explained_variance, wasserstein_distance, quantile_mapping_bias

Spectral / gradientspectral_error, gradient_error, psd_radial_error, spectral_angle_mapper

Climateseasonal_error, percentile_error, pixelwise_temporal_correlation, trend_error, extreme_event_duration_error, autocorrelation_error, wet_day_frequency_error, dry_spell_error, anomaly_correlation_coefficient

Ensembleensemble_spread, crps, rank_histogram, brier_score, spread_skill_ratio, crps_skill_score

Earth observationnormalized_difference_index, index_error, change_detection_error

Classification / segmentationiou, dice, precision_recall_f1, confusion_matrix_metrics, cohen_kappa

Uncertaintypicp, pit_histogram

Spatial verificationfractions_skill_score (FSS), energy_score

Time serieslag_correlation, cross_channel_correlation, peak_timing_error, dtw_distance


Plots

All importable directly from aule.plots.

Coreplot_scatter, plot_qq, plot_histogram_comparison, plot_error_histogram

Spatialplot_field_comparison, plot_bias_map, plot_correlation_map

Climateplot_temporal_trend, plot_temporal_scatter

Ensembleplot_ensemble_spread_map, plot_rank_histogram

Diagnosticsplot_taylor_diagram, plot_boxplot_comparison, plot_violin_comparison, plot_time_series, plot_error_map

Classificationplot_confusion_matrix, plot_reliability_diagram

Advancedplot_hovmoller, plot_cdf_comparison, plot_spectral_density, plot_time_evolution

Time seriesplot_lag_correlation, plot_multi_channel_series, plot_dtw_alignment, plot_channel_correlation_matrix

Spatial plots accept optional lat/lon arrays for a cartopy basemap (requires aule[geo]). Every plot returns (fig, ax) and accepts an optional save_path.

Divergent colormap normalizations

plot_bias_map, plot_error_map, and plot_field_comparison accept norm_type to control how extreme values stand out:

fig, ax = plot_bias_map(gt, pred, norm_type="symlog", norm_kwargs={"linthresh": 0.02})
# norm_type options: "linear" (default) | "power" | "symlog" | "twoslope"

Shape guardrails

Functions that require genuine spatial or temporal extent declare this explicitly. Passing a degenerate input raises a descriptive error:

series_gt = np.random.randn(1, 1, 4)   # H=W=1 — no real spatial extent
ssim(series_gt, series_gt)              # raises ValueError with a clear message

ssim(series_gt, series_gt, force=True)  # proceeds anyway with a warning

Object-oriented API

Bind arrays once, call everything as a method — including all new functions:

from aule import aule

v = aule(gt, pred)
print(v.rmse())
print(v.pearson_r())
fig, ax = v.plot_scatter()
fig, ax = v.plot_bias_map(norm_type="power")

Automatic validation report

from aule.report import generate_report

generate_report(gt, pred, save_path="report.html")

Produces a self-contained HTML file (figures embedded as base64 PNGs) with a metrics table and all key plots.


Documentation

python build_doc.py

Documentation is built with pdoc.

Download files

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

Source Distribution

aule-0.0.5.tar.gz (73.4 kB view details)

Uploaded Source

Built Distribution

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

aule-0.0.5-py3-none-any.whl (79.9 kB view details)

Uploaded Python 3

File details

Details for the file aule-0.0.5.tar.gz.

File metadata

  • Download URL: aule-0.0.5.tar.gz
  • Upload date:
  • Size: 73.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aule-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ff4f2f36205032ac06a6ad4c157fc06fb07b82acc15757364f8356b780a973f7
MD5 3ad8c96275d2c19641a7887e7a6c1f30
BLAKE2b-256 bc051966978c20f50fab9576f7f0c05c6394b293c189817b56a98300b3ad90bc

See more details on using hashes here.

File details

Details for the file aule-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: aule-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 79.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for aule-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 75be4747155488401f6164807814dbfcf813dc2b15e316571327b90eadfe7b84
MD5 53ccfe5c252fedead9b2065cd6c8bfca
BLAKE2b-256 756a8e950d8fa3bb4600987f9c14b08b79d17fbfefbe016bd65b2cc4790357b0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page