ecod-rs
The ECOD outlier detector (Li et al., 2022) in Rust, with Python bindings.
Why
The goal is ECOD with a normal API, which PyOD doesn't have.
In PyOD, fit only stores the training data, and decision_function concatenates it with the new samples and recomputes everything. So the score of a sample depends on the rest of the batch you pass in. This was reported in #401 and #426. Yue Zhao, PyOD's maintainer and an ECOD co-author, answered that this is intended, since outlier detection is transductive. Nothing has changed since.
Here you get both:
InductiveECODfits the per-feature ECDFs once and scores each sample independently.ECODbehaves like PyOD.
Install
Not on PyPI yet. Requires Python 3.12+ and a Rust toolchain:
pip install git+https://github.com/nedeadinside/ecod-rs
Usage
import numpy as np
from ecod_rs import InductiveECOD
rng = np.random.default_rng(0)
X_train = rng.normal(size=(1000, 10))
X_test = rng.normal(size=(200, 10))
model = InductiveECOD(contamination=0.1).fit(X_train)
scores = model.decision_function(X_test) # higher means more anomalous
labels = model.predict(X_test) # 1 is an outlier
proba = model.predict_proba(X_test) # shape (n, 2): [inlier, outlier]
model.save("model.bin")
model = InductiveECOD.load("model.bin")
ECOD has the same interface. Input is a numpy array or a list of lists.
The method argument sets the scoring: "max" (default) follows the paper, "pyod-max" reproduces PyOD's numbers, "left", "right" and "auto" use a single tail. predict_proba takes "linear" or "unify", as in PyOD.
Benchmark
Median speedup over PyOD's ECOD on random data and 47 ADBench datasets, single-threaded:
| ECOD | InductiveECOD | |
|---|---|---|
| fit | 2.7x | 2.7x |
| score | 5.9x | 7.5x |
| fit + score | 4.3x | 4.7x |
Full results are at nedeadinside.github.io/ecod-rs. To rerun: uv run --group bench python benchmark/bench.py.
Development
uv sync
uv run pytest
cargo test
License
MIT
Metadata
Release files for ecod-rs 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ecod_rs-1.0.0.tar.gz | 74.7 kB | Without provenance | Details for ecod_rs-1.0.0.tar.gz |
Built distributions (wheels)
Total release size: 5.4 MB
Release files / ecod_rs-1.0.0.tar.gz
| Download URL | ecod_rs-1.0.0.tar.gz |
|---|---|
| Size | 74.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78c043d4ea98448c21f8aa0c6c400e6f68463b06c331e7f159dfbf7aa9bd486d
|
|
BLAKE2b-256 checksum How to use checksums |
1ff93d1b368a14c3f33659b1433b405603339e1db261c85d1c9aec5c26933006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-win_arm64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 407.1 kB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ce29293c85312162f4c27c9beded4d25f6c871b1969283c44b05949d1a22de1c
|
|
BLAKE2b-256 checksum How to use checksums |
8bf5891444c6f8b5681a04b31ebaa42ad65ee57c531c57c59179d74044d6842c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-win_amd64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 425.1 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
46c6f81f9aa8b7363201b66442da6330b65c2296cd0e727f8853751fc7c8f418
|
|
BLAKE2b-256 checksum How to use checksums |
b4ba7fb0a0d0c3aacf97d6bf2b014d566283dd8cefb646bfc37cecf86740d7dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 961.6 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6aa8fea490229a0d9af70d04ac556434f8eb7c133208b5269047b2aae5e6ee5e
|
|
BLAKE2b-256 checksum How to use checksums |
3837f30de297c2d0b51fe01617106da92278b271e6f88b586afca82db9ed0416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-musllinux_1_2_aarch64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 901.2 kB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3ed2a90651137fdf3950c0de347e43ed51917aa765b4030f672790832030dd85
|
|
BLAKE2b-256 checksum How to use checksums |
2e45871d026a62032e5007c7cc47faf94be62bbdf1f2fe043a6502812cb75edf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 754.1 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
64e6ba7f8b08fda80554f8d99645f6c53d45c1ab99718cc24242346d1ad3f978
|
|
BLAKE2b-256 checksum How to use checksums |
457b3fc79b664305441168f976bef08bfae11997bfbd2eb886aa6ed5f4ae6af4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 692.3 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
b997b9105d954c66a124a30dc68910d629d0b90044209ea706b26a0ae14e04da
|
|
BLAKE2b-256 checksum How to use checksums |
6ca5870d51291b546b6ce35d0af2d134f063c43a378df2597a351863bc55b56b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 574.8 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
f08e944acd87d885bbf22a22a5e482f907f67fa821e0d3832ba0fc6c14700488
|
|
BLAKE2b-256 checksum How to use checksums |
c4600a433e4a379de73b0384e13c91db09465c615747713605ed72975da3846f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / ecod_rs-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | ecod_rs-1.0.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 645.8 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
884a6476167fbbc97ec3b2657427277e3413ac4ad8d030a2f9d2ccf686fc5bd5
|
|
BLAKE2b-256 checksum How to use checksums |
901700748649b3cd6f0fff08fabfcd7ee3733562cacc86fa800b065bbae7c9c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for ecod-rs 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.