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.1

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.1
File Size Uploaded Provenance Actions
limen_ml-0.1.1.tar.gz 19.6 kB With provenance Details for limen_ml-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 41.2 kB

Release files / limen_ml-0.1.1.tar.gz

Download URL limen_ml-0.1.1.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6379c4ea2ab26266b5d5568b01311c8795bbcc4e1109d54ed90b072c5a137c2e
BLAKE2b-256 checksum
How to use checksums
82c4319033f3a66914018b858df36987664e2783d125fcaefe011a2ded566a69
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.1-py3-none-any.whl

Download URL limen_ml-0.1.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ffbb12374a5775da0eed589489ac855c29285d8b5f849b76eb349cb83ed8087a
BLAKE2b-256 checksum
How to use checksums
df9c0d47faa4875370c10889b43f0fca7bb72c01e1bc4ca8b0ca1ded564b739a
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.1

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.1.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.1 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