Skip to main content

limen-ml

Documentation · Changelog

limen-ml is the machine learning of Limen, an open early-warning system for landslides, floods and wildfires in Italy: it trains a hazard model on spatial folds, calibrates it, tells when the world has drifted from its data, and serves a small network over a week of rain.

pip install "limen-ml[train]"         # LightGBM, scikit-learn, Optuna, SHAP
pip install "limen-ml[serve]"         # onnxruntime, to score with the rainfall network
pip install "limen-ml[dl]"            # PyTorch, to train it
from limen_ml import folds, matrix, metrics, train

m = matrix.to_matrix(samples, ("static.slope_deg", "rain.rain_72h_mm", "insar.velocity_mmy"))
k = folds.spatial_block_folds(list(m.groups), 5, rng_seed=42)

best = train.tune(m, k, trials=50, seed=42)
cv = train.cross_validate(m, k, best)  # AUC-PR, Brier, out-of-fold probabilities
calibrator = train.fit_isotonic(cv.oof_prob, cv.y)
model = train.fit_final(m, best, seed=42)
print(cv.auc_pr_mean, metrics.conformal_quantiles(cv.y, calibrator.transform(cv.oof_prob)))

A sample is anything with features (blocks of numbers), label (0/1) and split_block (its spatial block).

The rules

  • Spatial folds, the same for every model. Two cells a kilometre apart share their rain and their rock: a random split measures memory. Whole blocks go to one fold, and every algorithm is compared on the same folds.
  • AUC-PR, not accuracy. Landslides are one row in many; the area under the precision-recall curve stays honest where accuracy does not.
  • Not measured stays not measured. The application says which absent feature is NaN (a cell the satellite does not see is not a still slope) and which is a true zero; the logistic reference imputes with a "was missing" column.
  • A linear reference. A standardised logistic regression runs next to the boosted trees: if they do not beat it, the non-linear structure buys nothing.
  • Reproducible. Seeded search and folds, deterministic LightGBM, and a matrix hash on values rounded to nine decimals, so threads do not change it.
  • No database, no tracking, no schema. The application brings its samples, its feature schema and its baselines, and logs where it wants.
  • Checked against the code it replaces. Every function that comes from Limen is compared with Limen's own, frozen in tests/limen_reference.py.
  • A model never decides an alert. It is a challenger, promoted only by a person after a backtest. The official warning is the criticality bulletin of the Civil Protection Department.

Develop

make help    # the targets
make check   # ruff, mypy --strict, pytest: the gate CI runs

Licence

Code: Apache-2.0.

Metadata

Release files for limen-ml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for limen-ml 0.1.0
File Size Uploaded Provenance Actions
limen_ml-0.1.0.tar.gz 19.6 kB With provenance Details for limen_ml-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for limen-ml 0.1.0
File Interpreter ABI Platform Actions
limen_ml-0.1.0-py3-none-any.whl Python 3 none any Details for limen_ml-0.1.0-py3-none-any.whl

Total release size: 41.2 kB

Release files / limen_ml-0.1.0.tar.gz

Download URL limen_ml-0.1.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bb3b38dc6ea73da1609772ef459dc763cd5d6ed2ba33eb58deed498127b729a3
BLAKE2b-256 checksum
How to use checksums
2acf65cf9a52eeb4f7d998dc515e6f9f52f734428a2dbbde28c6e0e8bff6e8e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / limen_ml-0.1.0-py3-none-any.whl

Download URL limen_ml-0.1.0-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09692c8c1fa3165d22bf250d31f0cc6e3c25c7678b06eb599cb665b4c9d55a04
BLAKE2b-256 checksum
How to use checksums
14fc9fa2cbe3591da3d04e10b9cc37f40f4f0e090f3fe479a7c0e36c2a3e15f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for limen-ml 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for limen_ml-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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