Skip to main content

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:

  • InductiveECOD fits the per-feature ECDFs once and scores each sample independently.
  • ECOD behaves like PyOD.

Install

Requires Python 3.12+:

pip install 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 6.4x 6.2x
score 12.0x 17.7x
fit + score 9.4x 10.6x

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.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 ecod-rs 1.1.1
File Size Uploaded Provenance Actions
ecod_rs-1.1.1.tar.gz 75.4 kB Without provenance Details for ecod_rs-1.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ecod-rs 1.1.1
File Actions
ecod_rs-1.1.1-cp312-abi3-win_arm64.whl CPython 3.12 abi3 Windows ARM64 Details for ecod_rs-1.1.1-cp312-abi3-win_arm64.whl
ecod_rs-1.1.1-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details for ecod_rs-1.1.1-cp312-abi3-win_amd64.whl
ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details for ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_x86_64.whl
ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details for ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_aarch64.whl
ecod_rs-1.1.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 abi3 Linux glibc 2.17+ x86-64 Details for ecod_rs-1.1.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
ecod_rs-1.1.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details for ecod_rs-1.1.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
ecod_rs-1.1.1-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details for ecod_rs-1.1.1-cp312-abi3-macosx_11_0_arm64.whl
ecod_rs-1.1.1-cp312-abi3-macosx_10_12_x86_64.whl CPython 3.12 abi3 macOS 10.12+ x86-64 Details for ecod_rs-1.1.1-cp312-abi3-macosx_10_12_x86_64.whl

Total release size: 5.5 MB

Release files / ecod_rs-1.1.1.tar.gz

Download URL ecod_rs-1.1.1.tar.gz
Size 75.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b51b2fca95c2291f09224d3dd75b0bff41cbef5a48ab23e0994ebe86b0540d79
BLAKE2b-256 checksum
How to use checksums
eed2324423b67df655be8044631bc29e61ca620def151c404774874948f51b69
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.1.1-cp312-abi3-win_arm64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-win_arm64.whl
Size 412.3 kB
Tags CPython 3.12 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
6e491f27c509efeb795bb6de89ad16f5aaa30d2784e0c3861f9c52f2288d0a0f
BLAKE2b-256 checksum
How to use checksums
37550a5a8e40c76a76d7b3c1b706f5ac6a0a64dac2c7416e6dcaf705ea5c065a
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.1.1-cp312-abi3-win_amd64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-win_amd64.whl
Size 428.7 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2bd10802ae903f85e0776c66786cfec4a81917ba8c5be9ec403848a9ca092521
BLAKE2b-256 checksum
How to use checksums
8d55a25e9dd1c1ad99d489f05a035412d54a5bf640e040862278ec828d0c2387
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.1.1-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_x86_64.whl
Size 967.3 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
589e13ec1dcefc805fa57225ff7a55877df19c342a24f607962e1f307def44b4
BLAKE2b-256 checksum
How to use checksums
892ec5a13e009a81687305eeca76ac035dcf4df2dd0a048e3ef24caf3ce01730
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.1.1-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-musllinux_1_2_aarch64.whl
Size 905.2 kB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
c289fbbb305c8284428ec6f8e1cf30989120189a1b1bb0987a43cca5193a1e42
BLAKE2b-256 checksum
How to use checksums
294f3f6980834145291e00f1c66c178d45b26cebf15d6fb7ef1e5f844719e74d
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.1.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 758.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
463c8006d9e09355fffc15836fc14c731ab4f43c9fbf45324cba17dfa5afa35f
BLAKE2b-256 checksum
How to use checksums
453681abbfcc1fb4120ec0a15fad75c4e621d978ae977508689e84f4c3149644
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.1.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 694.8 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
1ed90b7a2c06734a88a206a202455d6b88b496f01379a5f3af831c9b3aa017d2
BLAKE2b-256 checksum
How to use checksums
037d34f420b04bfbefda7bfcd6d43b6d60aef24dd0bf2481e7c3e58966517899
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.1.1-cp312-abi3-macosx_11_0_arm64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-macosx_11_0_arm64.whl
Size 580.1 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a746e64aee6f4fd393722b4f125aa1b446c7a099b9bcdce2b588e943fe3529ab
BLAKE2b-256 checksum
How to use checksums
7acbe28b780c9725ae0a6891d7df8617515d99483f2137fddad538754afc9f2d
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.1.1-cp312-abi3-macosx_10_12_x86_64.whl

Download URL ecod_rs-1.1.1-cp312-abi3-macosx_10_12_x86_64.whl
Size 651.3 kB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
f48ed86bb992a7c8bc379d8644e39a62a2a9dee7109dc7c0b2319a7403f550c3
BLAKE2b-256 checksum
How to use checksums
1a1ed9d3bff015dc4e785234cce6017390b1a171431a1ee6489cf1979c9b9bce
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.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.

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.

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