Skip to main content

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

Project description

aule

aule provides validation metrics and plots for machine learning model outputs, with a focus on earth observation and climate science use cases (gridded fields, ensembles, multi-temporal data).

Named after Aulë, the Vala of craft in Tolkien's mythology — the one who forges and evaluates the work of his own hands.

Supported input shapes

Every function accepts numpy arrays in one of four shapes:

  • (batch, H, W, C)
  • (batch, H, W, C, T)
  • (H, W, C)
  • (H, W, C, T)

When an array is 4D, pass data_format="bhwc" (default) or data_format="hwct" to disambiguate, since the two shapes cannot be told apart from shape alone.

Installation

pip install aule

# with cartopy support for geographic basemaps
pip install aule[geo]

Quick example

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

gt   = np.random.rand(64, 64, 1)
pred = gt + np.random.normal(0, 0.1, gt.shape)

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

fig, axes = plot_field_comparison(gt, pred)
fig, ax = plot_scatter(gt, pred, save_path="scatter.png")

What's included

Metrics are organized by family in aule.metrics, all importable directly from aule.metrics:

  • core: rmse, mse, mae, bias, pearson_r, ssim, psnr, r2_score, mape, smape, nse, kge, max_error, explained_variance
  • spectral: spectral_error, gradient_error, psd_radial_error, spectral_angle_mapper
  • climate: seasonal_error, percentile_error, pixelwise_temporal_correlation, trend_error, extreme_event_duration_error, autocorrelation_error
  • ensemble: ensemble_spread, crps, rank_histogram, brier_score, spread_skill_ratio, crps_skill_score
  • earth_observation: normalized_difference_index, index_error, change_detection_error
  • classification: iou, dice, precision_recall_f1, confusion_matrix_metrics, cohen_kappa (binary or multi-class, via average/num_classes)
  • uncertainty: picp, pit_histogram

Plots are organized similarly in aule.plots:

  • core: plot_scatter, plot_qq, plot_histogram_comparison, plot_error_histogram
  • spatial: plot_field_comparison, plot_bias_map, plot_correlation_map (optional cartopy basemap via lat/lon)
  • climate: plot_temporal_trend, plot_temporal_scatter
  • ensemble: plot_ensemble_spread_map, plot_rank_histogram
  • diagnostics: plot_taylor_diagram, plot_boxplot_comparison, plot_violin_comparison, plot_time_series, plot_error_map
  • classification: plot_confusion_matrix, plot_reliability_diagram

Object-oriented usage

Every metric and plot is also available as a method on the aule class, which binds y_true/y_pred (and optionally data_format/ignore_nan) once. New functions added to aule.metrics or aule.plots are picked up automatically, no extra wiring needed.

from aule import aule

v = aule(gt, pred)
print(v.rmse())
print(v.pearson_r())
fig, ax = v.plot_scatter(save_path="scatter.png")

Notebooks

The notebooks/ folder contains worked examples for every metric and plot family, each runnable end-to-end:

  1. 01_core_metrics.ipynb
  2. 02_spectral_and_earth_observation_metrics.ipynb
  3. 03_climate_metrics.ipynb
  4. 04_ensemble_and_uncertainty_metrics.ipynb
  5. 05_classification_metrics.ipynb
  6. 06_plots.ipynb
  7. 07_aule_class.ipynb

Documentation

The documentation is produced using pdoc.

python build_doc.py

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

aule-0.0.3.tar.gz (42.0 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.3-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aule-0.0.3.tar.gz
  • Upload date:
  • Size: 42.0 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.3.tar.gz
Algorithm Hash digest
SHA256 1c2be91f5ccfe4f131add9003df07d912e31184f985364079b8163b6d61cf932
MD5 05c7cbcd20cc021c86ed4108f7450998
BLAKE2b-256 c97a19ef84fc6063c4e95979f7bae9934d324b031e46bc95e37bf0905f3d6c9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aule-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 47.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 acbb4b6fbe59c9adc0bc24840d58b227bb1350180e789efabb4e7bd6c0181937
MD5 b83f6a75d625fd1538e2f571a4d59f38
BLAKE2b-256 99fd057f551de15bb0557dad9959087d6c95ac16f9d80f7f71c5d1bff2c88487

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