ecod-rs 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ecod_rs-1.0.0/.github/workflows/ci.yml +46 -0
- ecod_rs-1.0.0/.github/workflows/release.yml +139 -0
- ecod_rs-1.0.0/.gitignore +6 -0
- ecod_rs-1.0.0/Cargo.lock +330 -0
- ecod_rs-1.0.0/Cargo.toml +16 -0
- ecod_rs-1.0.0/LICENSE +21 -0
- ecod_rs-1.0.0/PKG-INFO +85 -0
- ecod_rs-1.0.0/README.md +70 -0
- ecod_rs-1.0.0/benchmark/bench.py +534 -0
- ecod_rs-1.0.0/docs/index.html +236 -0
- ecod_rs-1.0.0/pyproject.toml +42 -0
- ecod_rs-1.0.0/python/ecod_rs/__init__.py +3 -0
- ecod_rs-1.0.0/python/ecod_rs/_core.pyi +42 -0
- ecod_rs-1.0.0/python/ecod_rs/models.py +3 -0
- ecod_rs-1.0.0/python/ecod_rs/py.typed +0 -0
- ecod_rs-1.0.0/src/algorithms/common.rs +261 -0
- ecod_rs-1.0.0/src/algorithms/ecod.rs +365 -0
- ecod_rs-1.0.0/src/algorithms/inductive_ecod.rs +334 -0
- ecod_rs-1.0.0/src/algorithms.rs +3 -0
- ecod_rs-1.0.0/src/errors.rs +103 -0
- ecod_rs-1.0.0/src/lib.rs +290 -0
- ecod_rs-1.0.0/src/matrix.rs +161 -0
- ecod_rs-1.0.0/src/types.rs +154 -0
- ecod_rs-1.0.0/tests/conftest.py +26 -0
- ecod_rs-1.0.0/tests/test_decision_function.py +127 -0
- ecod_rs-1.0.0/tests/test_fit.py +39 -0
- ecod_rs-1.0.0/tests/test_persistence.py +79 -0
- ecod_rs-1.0.0/tests/test_predict.py +12 -0
- ecod_rs-1.0.0/uv.lock +711 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
env:
|
|
13
|
+
CARGO_TERM_COLOR: always
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
fmt:
|
|
17
|
+
name: Format
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v5
|
|
21
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
22
|
+
with:
|
|
23
|
+
components: rustfmt
|
|
24
|
+
- run: cargo fmt --all --check
|
|
25
|
+
|
|
26
|
+
test:
|
|
27
|
+
name: Test
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v5
|
|
31
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
32
|
+
- uses: Swatinem/rust-cache@v2
|
|
33
|
+
- run: cargo test --all-features
|
|
34
|
+
|
|
35
|
+
pytest:
|
|
36
|
+
name: Python tests
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v5
|
|
40
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
41
|
+
- uses: Swatinem/rust-cache@v2
|
|
42
|
+
- uses: astral-sh/setup-uv@v8.1.0
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.13"
|
|
45
|
+
- run: uv sync --locked
|
|
46
|
+
- run: uv run pytest
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
linux:
|
|
14
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
platform:
|
|
18
|
+
- runner: ubuntu-22.04
|
|
19
|
+
target: x86_64
|
|
20
|
+
- runner: ubuntu-22.04
|
|
21
|
+
target: aarch64
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v6
|
|
24
|
+
- uses: actions/setup-python@v6
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
- name: Build wheels
|
|
28
|
+
uses: PyO3/maturin-action@v1
|
|
29
|
+
with:
|
|
30
|
+
target: ${{ matrix.platform.target }}
|
|
31
|
+
args: --release --out dist
|
|
32
|
+
manylinux: auto
|
|
33
|
+
- uses: actions/upload-artifact@v6
|
|
34
|
+
with:
|
|
35
|
+
name: wheels-linux-${{ matrix.platform.target }}
|
|
36
|
+
path: dist
|
|
37
|
+
|
|
38
|
+
musllinux:
|
|
39
|
+
runs-on: ubuntu-22.04
|
|
40
|
+
strategy:
|
|
41
|
+
matrix:
|
|
42
|
+
target: [x86_64, aarch64]
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v6
|
|
45
|
+
- uses: actions/setup-python@v6
|
|
46
|
+
with:
|
|
47
|
+
python-version: "3.12"
|
|
48
|
+
- name: Build wheels
|
|
49
|
+
uses: PyO3/maturin-action@v1
|
|
50
|
+
with:
|
|
51
|
+
target: ${{ matrix.target }}
|
|
52
|
+
args: --release --out dist
|
|
53
|
+
manylinux: musllinux_1_2
|
|
54
|
+
- uses: actions/upload-artifact@v6
|
|
55
|
+
with:
|
|
56
|
+
name: wheels-musllinux-${{ matrix.target }}
|
|
57
|
+
path: dist
|
|
58
|
+
|
|
59
|
+
windows:
|
|
60
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
61
|
+
strategy:
|
|
62
|
+
matrix:
|
|
63
|
+
platform:
|
|
64
|
+
- runner: windows-latest
|
|
65
|
+
target: x64
|
|
66
|
+
python_arch: x64
|
|
67
|
+
- runner: windows-11-arm
|
|
68
|
+
target: aarch64
|
|
69
|
+
python_arch: arm64
|
|
70
|
+
steps:
|
|
71
|
+
- uses: actions/checkout@v6
|
|
72
|
+
- uses: actions/setup-python@v6
|
|
73
|
+
with:
|
|
74
|
+
python-version: "3.13"
|
|
75
|
+
architecture: ${{ matrix.platform.python_arch }}
|
|
76
|
+
- name: Build wheels
|
|
77
|
+
uses: PyO3/maturin-action@v1
|
|
78
|
+
with:
|
|
79
|
+
target: ${{ matrix.platform.target }}
|
|
80
|
+
args: --release --out dist
|
|
81
|
+
- uses: actions/upload-artifact@v6
|
|
82
|
+
with:
|
|
83
|
+
name: wheels-windows-${{ matrix.platform.target }}
|
|
84
|
+
path: dist
|
|
85
|
+
|
|
86
|
+
macos:
|
|
87
|
+
runs-on: ${{ matrix.platform.runner }}
|
|
88
|
+
strategy:
|
|
89
|
+
matrix:
|
|
90
|
+
platform:
|
|
91
|
+
- runner: macos-15-intel
|
|
92
|
+
target: x86_64
|
|
93
|
+
- runner: macos-latest
|
|
94
|
+
target: aarch64
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v6
|
|
97
|
+
- uses: actions/setup-python@v6
|
|
98
|
+
with:
|
|
99
|
+
python-version: "3.12"
|
|
100
|
+
- name: Build wheels
|
|
101
|
+
uses: PyO3/maturin-action@v1
|
|
102
|
+
with:
|
|
103
|
+
target: ${{ matrix.platform.target }}
|
|
104
|
+
args: --release --out dist
|
|
105
|
+
- uses: actions/upload-artifact@v6
|
|
106
|
+
with:
|
|
107
|
+
name: wheels-macos-${{ matrix.platform.target }}
|
|
108
|
+
path: dist
|
|
109
|
+
|
|
110
|
+
sdist:
|
|
111
|
+
runs-on: ubuntu-latest
|
|
112
|
+
steps:
|
|
113
|
+
- uses: actions/checkout@v6
|
|
114
|
+
- name: Build sdist
|
|
115
|
+
uses: PyO3/maturin-action@v1
|
|
116
|
+
with:
|
|
117
|
+
command: sdist
|
|
118
|
+
args: --out dist
|
|
119
|
+
- uses: actions/upload-artifact@v6
|
|
120
|
+
with:
|
|
121
|
+
name: wheels-sdist
|
|
122
|
+
path: dist
|
|
123
|
+
|
|
124
|
+
release:
|
|
125
|
+
name: Publish to PyPI
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
128
|
+
needs: [linux, musllinux, windows, macos, sdist]
|
|
129
|
+
environment: pypi
|
|
130
|
+
permissions:
|
|
131
|
+
id-token: write
|
|
132
|
+
attestations: write
|
|
133
|
+
steps:
|
|
134
|
+
- uses: actions/download-artifact@v7
|
|
135
|
+
- uses: actions/attest@v4
|
|
136
|
+
with:
|
|
137
|
+
subject-path: 'wheels-*/*'
|
|
138
|
+
- uses: astral-sh/setup-uv@v7
|
|
139
|
+
- run: uv publish --trusted-publishing always 'wheels-*/*'
|
ecod_rs-1.0.0/.gitignore
ADDED
ecod_rs-1.0.0/Cargo.lock
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "arrayvec"
|
|
7
|
+
version = "0.7.8"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "autocfg"
|
|
13
|
+
version = "1.5.1"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "bitcode"
|
|
19
|
+
version = "0.6.9"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "0a6ed1b54d8dc333e7be604d00fa9262f4635485ffea923647b6521a5fff045d"
|
|
22
|
+
dependencies = [
|
|
23
|
+
"arrayvec",
|
|
24
|
+
"bitcode_derive",
|
|
25
|
+
"bytemuck",
|
|
26
|
+
"glam",
|
|
27
|
+
"serde",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "bitcode_derive"
|
|
32
|
+
version = "0.6.9"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "238b90427dfad9da4a9abd60f3ec1cdee6b80454bde49ed37f1781dd8e9dc7f9"
|
|
35
|
+
dependencies = [
|
|
36
|
+
"proc-macro2",
|
|
37
|
+
"quote",
|
|
38
|
+
"syn 2.0.119",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[[package]]
|
|
42
|
+
name = "bytemuck"
|
|
43
|
+
version = "1.25.2"
|
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
+
checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797"
|
|
46
|
+
|
|
47
|
+
[[package]]
|
|
48
|
+
name = "cc"
|
|
49
|
+
version = "1.8.0"
|
|
50
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
51
|
+
checksum = "6651c9ed80effdc7db0ff72512157f901af5e3549e341e24b1dd4887d836d838"
|
|
52
|
+
dependencies = [
|
|
53
|
+
"find-msvc-tools",
|
|
54
|
+
"jobserver",
|
|
55
|
+
"libc",
|
|
56
|
+
"shlex",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "cfg-if"
|
|
61
|
+
version = "1.0.5"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
64
|
+
|
|
65
|
+
[[package]]
|
|
66
|
+
name = "ecod-rs"
|
|
67
|
+
version = "1.0.0"
|
|
68
|
+
dependencies = [
|
|
69
|
+
"bitcode",
|
|
70
|
+
"libm",
|
|
71
|
+
"num-traits",
|
|
72
|
+
"pyo3",
|
|
73
|
+
"zstd",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "find-msvc-tools"
|
|
78
|
+
version = "0.1.14"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "getrandom"
|
|
84
|
+
version = "0.4.3"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"cfg-if",
|
|
89
|
+
"libc",
|
|
90
|
+
"r-efi",
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
[[package]]
|
|
94
|
+
name = "glam"
|
|
95
|
+
version = "0.34.1"
|
|
96
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
97
|
+
checksum = "fc148d4ddd3930c52f9e5ae79b89805c6f07e9ff417e7b083e0348cea60a5aba"
|
|
98
|
+
|
|
99
|
+
[[package]]
|
|
100
|
+
name = "heck"
|
|
101
|
+
version = "0.5.0"
|
|
102
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
103
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
104
|
+
|
|
105
|
+
[[package]]
|
|
106
|
+
name = "jobserver"
|
|
107
|
+
version = "0.1.35"
|
|
108
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
109
|
+
checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3"
|
|
110
|
+
dependencies = [
|
|
111
|
+
"getrandom",
|
|
112
|
+
"libc",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "libc"
|
|
117
|
+
version = "0.2.190"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
|
|
120
|
+
|
|
121
|
+
[[package]]
|
|
122
|
+
name = "libm"
|
|
123
|
+
version = "0.2.16"
|
|
124
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
125
|
+
checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981"
|
|
126
|
+
|
|
127
|
+
[[package]]
|
|
128
|
+
name = "num-traits"
|
|
129
|
+
version = "0.2.19"
|
|
130
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
132
|
+
dependencies = [
|
|
133
|
+
"autocfg",
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
[[package]]
|
|
137
|
+
name = "once_cell"
|
|
138
|
+
version = "1.21.4"
|
|
139
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
140
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
141
|
+
|
|
142
|
+
[[package]]
|
|
143
|
+
name = "pkg-config"
|
|
144
|
+
version = "0.3.34"
|
|
145
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
146
|
+
checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
|
|
147
|
+
|
|
148
|
+
[[package]]
|
|
149
|
+
name = "portable-atomic"
|
|
150
|
+
version = "1.15.0"
|
|
151
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
152
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
153
|
+
|
|
154
|
+
[[package]]
|
|
155
|
+
name = "proc-macro2"
|
|
156
|
+
version = "1.0.107"
|
|
157
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
159
|
+
dependencies = [
|
|
160
|
+
"unicode-ident",
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
[[package]]
|
|
164
|
+
name = "pyo3"
|
|
165
|
+
version = "0.29.3"
|
|
166
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
167
|
+
checksum = "700d18fa267b73b9b521fd7e13580e2f446916f176cacee1ab63fcc8191f1655"
|
|
168
|
+
dependencies = [
|
|
169
|
+
"libc",
|
|
170
|
+
"once_cell",
|
|
171
|
+
"portable-atomic",
|
|
172
|
+
"pyo3-build-config",
|
|
173
|
+
"pyo3-ffi",
|
|
174
|
+
"pyo3-macros",
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "pyo3-build-config"
|
|
179
|
+
version = "0.29.3"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "7b3fc0c4d08f6bb10e71fe39dfb9e2f59c6eb6854e22ec8092f50c69a4499adb"
|
|
182
|
+
dependencies = [
|
|
183
|
+
"target-lexicon",
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
[[package]]
|
|
187
|
+
name = "pyo3-ffi"
|
|
188
|
+
version = "0.29.3"
|
|
189
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
190
|
+
checksum = "dfc0b8e19df29aad7086cf977bb0c2a2f143e30567eb113e9cf72b62ca698330"
|
|
191
|
+
dependencies = [
|
|
192
|
+
"libc",
|
|
193
|
+
"pyo3-build-config",
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
[[package]]
|
|
197
|
+
name = "pyo3-macros"
|
|
198
|
+
version = "0.29.3"
|
|
199
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
200
|
+
checksum = "6100e8a4b5eba53afaa5ed078364851a0b2499c553a44c31026b929049b49dc6"
|
|
201
|
+
dependencies = [
|
|
202
|
+
"proc-macro2",
|
|
203
|
+
"pyo3-macros-backend",
|
|
204
|
+
"quote",
|
|
205
|
+
"syn 2.0.119",
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
[[package]]
|
|
209
|
+
name = "pyo3-macros-backend"
|
|
210
|
+
version = "0.29.3"
|
|
211
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
212
|
+
checksum = "6143877a16e82b5a727b7127ff4cd86858a24a28d745d72f43e6f227c7b1bdb3"
|
|
213
|
+
dependencies = [
|
|
214
|
+
"heck",
|
|
215
|
+
"proc-macro2",
|
|
216
|
+
"quote",
|
|
217
|
+
"syn 2.0.119",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
[[package]]
|
|
221
|
+
name = "quote"
|
|
222
|
+
version = "1.0.47"
|
|
223
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
224
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
225
|
+
dependencies = [
|
|
226
|
+
"proc-macro2",
|
|
227
|
+
]
|
|
228
|
+
|
|
229
|
+
[[package]]
|
|
230
|
+
name = "r-efi"
|
|
231
|
+
version = "6.0.0"
|
|
232
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
+
checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
|
|
234
|
+
|
|
235
|
+
[[package]]
|
|
236
|
+
name = "serde"
|
|
237
|
+
version = "1.0.229"
|
|
238
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
239
|
+
checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
|
|
240
|
+
dependencies = [
|
|
241
|
+
"serde_core",
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
[[package]]
|
|
245
|
+
name = "serde_core"
|
|
246
|
+
version = "1.0.229"
|
|
247
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
248
|
+
checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
|
|
249
|
+
dependencies = [
|
|
250
|
+
"serde_derive",
|
|
251
|
+
]
|
|
252
|
+
|
|
253
|
+
[[package]]
|
|
254
|
+
name = "serde_derive"
|
|
255
|
+
version = "1.0.229"
|
|
256
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
+
checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
258
|
+
dependencies = [
|
|
259
|
+
"proc-macro2",
|
|
260
|
+
"quote",
|
|
261
|
+
"syn 3.0.9",
|
|
262
|
+
]
|
|
263
|
+
|
|
264
|
+
[[package]]
|
|
265
|
+
name = "shlex"
|
|
266
|
+
version = "2.0.1"
|
|
267
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
268
|
+
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "syn"
|
|
272
|
+
version = "2.0.119"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
|
|
275
|
+
dependencies = [
|
|
276
|
+
"proc-macro2",
|
|
277
|
+
"quote",
|
|
278
|
+
"unicode-ident",
|
|
279
|
+
]
|
|
280
|
+
|
|
281
|
+
[[package]]
|
|
282
|
+
name = "syn"
|
|
283
|
+
version = "3.0.9"
|
|
284
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
285
|
+
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
|
286
|
+
dependencies = [
|
|
287
|
+
"proc-macro2",
|
|
288
|
+
"quote",
|
|
289
|
+
"unicode-ident",
|
|
290
|
+
]
|
|
291
|
+
|
|
292
|
+
[[package]]
|
|
293
|
+
name = "target-lexicon"
|
|
294
|
+
version = "0.13.5"
|
|
295
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
296
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
297
|
+
|
|
298
|
+
[[package]]
|
|
299
|
+
name = "unicode-ident"
|
|
300
|
+
version = "1.0.27"
|
|
301
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
302
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
303
|
+
|
|
304
|
+
[[package]]
|
|
305
|
+
name = "zstd"
|
|
306
|
+
version = "0.14.2"
|
|
307
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
308
|
+
checksum = "057cfd910cfac363a0ada849592624b4c9ff2e10bef504c3433810d78ed96f93"
|
|
309
|
+
dependencies = [
|
|
310
|
+
"zstd-safe",
|
|
311
|
+
]
|
|
312
|
+
|
|
313
|
+
[[package]]
|
|
314
|
+
name = "zstd-safe"
|
|
315
|
+
version = "8.1.0"
|
|
316
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
317
|
+
checksum = "bdd44c6a7284e91f3717755b24315a302edd9153a01f753c3cba3d765e8eafac"
|
|
318
|
+
dependencies = [
|
|
319
|
+
"zstd-sys",
|
|
320
|
+
]
|
|
321
|
+
|
|
322
|
+
[[package]]
|
|
323
|
+
name = "zstd-sys"
|
|
324
|
+
version = "2.1.1+zstd.1.5.7"
|
|
325
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
326
|
+
checksum = "aeec9eaf2dffbbd09201e23bd0ffcbaa33bb8e9266a10734fd7ed90a85eca078"
|
|
327
|
+
dependencies = [
|
|
328
|
+
"cc",
|
|
329
|
+
"pkg-config",
|
|
330
|
+
]
|
ecod_rs-1.0.0/Cargo.toml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "ecod-rs"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
edition = "2024"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "_core"
|
|
9
|
+
crate-type = ["cdylib"]
|
|
10
|
+
|
|
11
|
+
[dependencies]
|
|
12
|
+
bitcode = "0.6.9"
|
|
13
|
+
libm = "0.2.16"
|
|
14
|
+
num-traits = "0.2"
|
|
15
|
+
pyo3 = { version = "0.29.2", features = ["abi3-py312"] }
|
|
16
|
+
zstd = "0.14.2"
|
ecod_rs-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matthew Bondarev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ecod_rs-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ecod-rs
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Requires-Dist: numpy>=1.26
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Summary: ECOD rust implementation.
|
|
7
|
+
Author-email: nedeadinside <aquvva67@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Requires-Python: >=3.12, <3.15
|
|
10
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
11
|
+
Project-URL: Author, https://github.com/nedeadinside
|
|
12
|
+
Project-URL: Issues, https://github.com/nedeadinside/ecod-rs/issues
|
|
13
|
+
Project-URL: Repository, https://github.com/nedeadinside/ecod-rs
|
|
14
|
+
|
|
15
|
+
# ecod-rs
|
|
16
|
+
|
|
17
|
+
The ECOD outlier detector ([Li et al., 2022](https://arxiv.org/abs/2201.00382)) in Rust, with Python bindings.
|
|
18
|
+
|
|
19
|
+
## Why
|
|
20
|
+
|
|
21
|
+
The goal is ECOD with a normal API, which PyOD doesn't have.
|
|
22
|
+
|
|
23
|
+
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](https://github.com/yzhao062/pyod/issues/401) and [#426](https://github.com/yzhao062/pyod/issues/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.
|
|
24
|
+
|
|
25
|
+
Here you get both:
|
|
26
|
+
|
|
27
|
+
- `InductiveECOD` fits the per-feature ECDFs once and scores each sample independently.
|
|
28
|
+
- `ECOD` behaves like PyOD.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
Not on PyPI yet. Requires Python 3.12+ and a Rust toolchain:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install git+https://github.com/nedeadinside/ecod-rs
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import numpy as np
|
|
42
|
+
from ecod_rs import InductiveECOD
|
|
43
|
+
|
|
44
|
+
rng = np.random.default_rng(0)
|
|
45
|
+
X_train = rng.normal(size=(1000, 10))
|
|
46
|
+
X_test = rng.normal(size=(200, 10))
|
|
47
|
+
|
|
48
|
+
model = InductiveECOD(contamination=0.1).fit(X_train)
|
|
49
|
+
|
|
50
|
+
scores = model.decision_function(X_test) # higher means more anomalous
|
|
51
|
+
labels = model.predict(X_test) # 1 is an outlier
|
|
52
|
+
proba = model.predict_proba(X_test) # shape (n, 2): [inlier, outlier]
|
|
53
|
+
|
|
54
|
+
model.save("model.bin")
|
|
55
|
+
model = InductiveECOD.load("model.bin")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
`ECOD` has the same interface. Input is a numpy array or a list of lists.
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
## Benchmark
|
|
63
|
+
|
|
64
|
+
Median speedup over PyOD's ECOD on random data and 47 ADBench datasets, single-threaded:
|
|
65
|
+
|
|
66
|
+
| | ECOD | InductiveECOD |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| fit | 2.7x | 2.7x |
|
|
69
|
+
| score | 5.9x | 7.5x |
|
|
70
|
+
| fit + score | 4.3x | 4.7x |
|
|
71
|
+
|
|
72
|
+
Full results are at [nedeadinside.github.io/ecod-rs](https://nedeadinside.github.io/ecod-rs/). To rerun: `uv run --group bench python benchmark/bench.py`.
|
|
73
|
+
|
|
74
|
+
## Development
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
uv sync
|
|
78
|
+
uv run pytest
|
|
79
|
+
cargo test
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT
|
|
85
|
+
|