Skip to main content

milia: cluster, rank, detect

Cluster, rank and detect in time series.

PyPI Python License

Documentation · Quickstart · User guide · Tutorials · API · Changelog

milia groups series that behave alike, finds the cases most similar to a given one, and flags the days or windows that are not normal. It grew out of smart-meter and energy load profiles, which is its home domain, and its methods apply to other time series such as sensor, traffic, retail or clinical signals. Every learned component is a scikit-learn estimator, so it clones, pickles, tunes and composes in a Pipeline.

Milia is Swahili for stripes: a zebra is recognised in its herd by its stripe pattern, as a series is recognised among thousands.

Cluster

Find the herds.
Group the series that behave alike, and see how far to trust the groups.

Rank

Find the look-alikes.
Retrieve the most similar cases, and the action that worked for them.

Detect

Spot the odd stripe.
Flag the days that are not normal, at a false-alarm rate that you set.

Install

pip install pundamilia              # the distribution; import it as milia
pip install 'pundamilia[all]'       # with plots, tuning, tensor and the other extras

Quick start

from milia import make
from milia.data import synthetic, profiles
from milia.cluster import validation, selection

population = synthetic.generate(meters=60, days=90, steps=48)
shapes = profiles.shape(population.pivot)
scores = validation.sweep(shapes, range(2, 8), resampling=True)
k = selection.recommend(scores, strategy="trust")
labels = make("clusterer", "kmeans", n_clusters=k).fit_predict(shapes)

Anomalous days with a conformal guarantee on the share of normal days flagged:

from milia.anomaly.ensemble import Ensemble
from milia.features.window import vector

X = [vector(day) for day in profiles.tensor(population.pivot)[0]]
detector = Ensemble().fit(X[:60]).calibrate(X[60:80], alpha=0.1)
flags = detector.flag(X[80:])

Models are registered by module: milia.available("detector") lists them. The documentation has the user guide, the tutorials and the API reference.

Developer

Developed by Anthony Faustine (LinkedIn).

Citation

If you use milia in your work, please cite it:

@software{faustine2026milia,
  title  = {milia: cluster, rank and detect in time series},
  author = {Faustine, Anthony},
  year   = {2026},
  url    = {https://sambaiga.github.io/pundamilia-docs/}
}

Contributing

Open a pull request against main with a conventional-commit title. make test and make lint run the suite and the linters.

License

Apache-2.0.

Metadata

Release files for pundamilia 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 pundamilia 0.1.1
File Size Uploaded Provenance Actions
pundamilia-0.1.1.tar.gz 490.4 kB With provenance Details for pundamilia-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 737.1 kB

Release files / pundamilia-0.1.1.tar.gz

Download URL pundamilia-0.1.1.tar.gz
Size 490.4 kB
Tags Source
SHA-256 checksum
How to use checksums
60f2d8f337dca110e4db56e9aea16307b92c2bb7fd2db073defff143c0fefdcc
BLAKE2b-256 checksum
How to use checksums
b53553a66a6e2d80c18b5583ec02312ddfd22dcc0d780734b27d6203b5ec9485
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 13, 2026.

Transparency log

Release files / pundamilia-0.1.1-py3-none-any.whl

Download URL pundamilia-0.1.1-py3-none-any.whl
Size 246.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95ac49220bec93b7b0f767aedee91c494cde96e8bbde0bd20b5e9889dce60709
BLAKE2b-256 checksum
How to use checksums
9382079f6fd0826d066bd2210c8644168d684cfc51f666c4df8227500b8076e1
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 13, 2026.

Transparency log

Security for pundamilia 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 pundamilia-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 13, 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