pyfastauc 0.1.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.
- pyfastauc-0.1.0/.gitignore +9 -0
- pyfastauc-0.1.0/CHANGELOG.md +25 -0
- pyfastauc-0.1.0/Cargo.lock +280 -0
- pyfastauc-0.1.0/Cargo.toml +27 -0
- pyfastauc-0.1.0/LICENSE +21 -0
- pyfastauc-0.1.0/PKG-INFO +455 -0
- pyfastauc-0.1.0/README.md +426 -0
- pyfastauc-0.1.0/benchmarks/bench.py +110 -0
- pyfastauc-0.1.0/benchmarks/bench_vs_others.py +138 -0
- pyfastauc-0.1.0/benchmarks/evidence.py +447 -0
- pyfastauc-0.1.0/benchmarks/tie_leak.py +178 -0
- pyfastauc-0.1.0/examples/lightgbm_eval.py +68 -0
- pyfastauc-0.1.0/examples/pytorch_eval.py +53 -0
- pyfastauc-0.1.0/examples/xgboost_eval.py +57 -0
- pyfastauc-0.1.0/pyproject.toml +43 -0
- pyfastauc-0.1.0/python/fastauc/__init__.py +1389 -0
- pyfastauc-0.1.0/python/fastauc/_core.pyi +48 -0
- pyfastauc-0.1.0/python/fastauc/py.typed +0 -0
- pyfastauc-0.1.0/src/lib.rs +1235 -0
- pyfastauc-0.1.0/tests/test_curves_delong.py +291 -0
- pyfastauc-0.1.0/tests/test_fastauc.py +342 -0
- pyfastauc-0.1.0/tests/test_features.py +332 -0
- pyfastauc-0.1.0/tests/test_metrics.py +463 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
Initial release, published on PyPI as `pyfastauc` (imported as `fastauc`).
|
|
6
|
+
|
|
7
|
+
- `roc_auc`, `average_precision`, `roc_auc_ap`: single-pair metrics matching scikit-learn, with `sample_weight` and `pos_label`.
|
|
8
|
+
- `pr_auc`: trapezoidal area under the precision-recall curve, matching `sklearn.metrics.auc(recall, precision)`, kept distinct from average precision.
|
|
9
|
+
- `roc_auc_ap_batch`: many models vs one target, one model vs many targets (single sort), or row-wise pairs, in parallel.
|
|
10
|
+
- `roc_auc_ap_grouped`: per-group (per-query, per-user) metrics and GAUC.
|
|
11
|
+
- `bootstrap_roc_auc_ap`: sort-once bootstrap with optional stratification, percentile CIs, and paired multi-model comparison.
|
|
12
|
+
- `binary_metrics`: ROC-AUC, average precision, trapezoidal PR-AUC, KS, max F1 and calibration in one call.
|
|
13
|
+
- `ks_statistic`, `max_f1`, `precision_at_recall`, `recall_at_precision`, `tpr_at_fpr`, `lift_at`.
|
|
14
|
+
- `calibration_metrics`, `log_loss`, `brier_score`, `normalized_entropy`, `calibration_ratio`, `expected_calibration_error`.
|
|
15
|
+
- `ranking_metrics`: GAUC, NDCG, MRR, MAP, recall, precision and hit rate at several cutoffs, graded relevance, exact tie handling.
|
|
16
|
+
- Every metric is invariant to input row order; tied scores are never broken by position.
|
|
17
|
+
- Cluster bootstrap: `bootstrap_roc_auc_ap(groups=...)` resamples whole groups; `bootstrap_ranking_metrics` resamples queries, with paired multi-model comparison.
|
|
18
|
+
- `sample_weight` in `bootstrap_roc_auc_ap` and `ranking_metrics`.
|
|
19
|
+
- `axis` argument for 2-D inputs (`axis=0` for the scikit-learn layout).
|
|
20
|
+
- `set_num_threads` / `num_threads`; results are identical for any thread count.
|
|
21
|
+
- O(N) fast path for integer group ids.
|
|
22
|
+
- Type stub for the native module; LightGBM, XGBoost and PyTorch examples.
|
|
23
|
+
- `delong_roc_auc`: DeLong confidence intervals and paired test for ROC-AUC (Sun and Xu's fast algorithm).
|
|
24
|
+
- `roc_curve`, `precision_recall_curve`, `calibration_curve`, matching scikit-learn's output.
|
|
25
|
+
- Uniform ECE bins now follow scikit-learn's edge convention (a value exactly on an edge goes to the lower bin).
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "crossbeam-deque"
|
|
13
|
+
version = "0.8.8"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"crossbeam-epoch",
|
|
18
|
+
"crossbeam-utils",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[[package]]
|
|
22
|
+
name = "crossbeam-epoch"
|
|
23
|
+
version = "0.9.21"
|
|
24
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
25
|
+
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"crossbeam-utils",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[[package]]
|
|
31
|
+
name = "crossbeam-utils"
|
|
32
|
+
version = "0.8.23"
|
|
33
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
34
|
+
checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6"
|
|
35
|
+
|
|
36
|
+
[[package]]
|
|
37
|
+
name = "either"
|
|
38
|
+
version = "1.19.0"
|
|
39
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
40
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
41
|
+
|
|
42
|
+
[[package]]
|
|
43
|
+
name = "fastauc"
|
|
44
|
+
version = "0.1.0"
|
|
45
|
+
dependencies = [
|
|
46
|
+
"numpy",
|
|
47
|
+
"pyo3",
|
|
48
|
+
"rayon",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "heck"
|
|
53
|
+
version = "0.5.0"
|
|
54
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
55
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
56
|
+
|
|
57
|
+
[[package]]
|
|
58
|
+
name = "libc"
|
|
59
|
+
version = "0.2.191"
|
|
60
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
61
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
62
|
+
|
|
63
|
+
[[package]]
|
|
64
|
+
name = "matrixmultiply"
|
|
65
|
+
version = "0.3.11"
|
|
66
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
67
|
+
checksum = "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7"
|
|
68
|
+
dependencies = [
|
|
69
|
+
"autocfg",
|
|
70
|
+
"rawpointer",
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
[[package]]
|
|
74
|
+
name = "ndarray"
|
|
75
|
+
version = "0.17.2"
|
|
76
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
77
|
+
checksum = "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d"
|
|
78
|
+
dependencies = [
|
|
79
|
+
"matrixmultiply",
|
|
80
|
+
"num-complex",
|
|
81
|
+
"num-integer",
|
|
82
|
+
"num-traits",
|
|
83
|
+
"portable-atomic",
|
|
84
|
+
"portable-atomic-util",
|
|
85
|
+
"rawpointer",
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
[[package]]
|
|
89
|
+
name = "num-complex"
|
|
90
|
+
version = "0.4.6"
|
|
91
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
93
|
+
dependencies = [
|
|
94
|
+
"num-traits",
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "num-integer"
|
|
99
|
+
version = "0.1.47"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b"
|
|
102
|
+
dependencies = [
|
|
103
|
+
"num-traits",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "num-traits"
|
|
108
|
+
version = "0.2.19"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"autocfg",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "numpy"
|
|
117
|
+
version = "0.30.0"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "aa0b9111761885449e894981fa8051dcf69e0bd114aecbd4bcdd830b6be4ed92"
|
|
120
|
+
dependencies = [
|
|
121
|
+
"libc",
|
|
122
|
+
"ndarray",
|
|
123
|
+
"num-complex",
|
|
124
|
+
"num-integer",
|
|
125
|
+
"num-traits",
|
|
126
|
+
"pyo3",
|
|
127
|
+
"pyo3-build-config",
|
|
128
|
+
"rustc-hash",
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
[[package]]
|
|
132
|
+
name = "once_cell"
|
|
133
|
+
version = "1.21.4"
|
|
134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
135
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
136
|
+
|
|
137
|
+
[[package]]
|
|
138
|
+
name = "portable-atomic"
|
|
139
|
+
version = "1.15.0"
|
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
+
checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
142
|
+
|
|
143
|
+
[[package]]
|
|
144
|
+
name = "portable-atomic-util"
|
|
145
|
+
version = "0.2.8"
|
|
146
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
+
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
|
|
148
|
+
dependencies = [
|
|
149
|
+
"portable-atomic",
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "proc-macro2"
|
|
154
|
+
version = "1.0.107"
|
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
+
checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
|
|
157
|
+
dependencies = [
|
|
158
|
+
"unicode-ident",
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
[[package]]
|
|
162
|
+
name = "pyo3"
|
|
163
|
+
version = "0.30.1"
|
|
164
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
165
|
+
checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
|
|
166
|
+
dependencies = [
|
|
167
|
+
"libc",
|
|
168
|
+
"once_cell",
|
|
169
|
+
"portable-atomic",
|
|
170
|
+
"pyo3-build-config",
|
|
171
|
+
"pyo3-ffi",
|
|
172
|
+
"pyo3-macros",
|
|
173
|
+
]
|
|
174
|
+
|
|
175
|
+
[[package]]
|
|
176
|
+
name = "pyo3-build-config"
|
|
177
|
+
version = "0.30.1"
|
|
178
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
179
|
+
checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
|
|
180
|
+
dependencies = [
|
|
181
|
+
"target-lexicon",
|
|
182
|
+
]
|
|
183
|
+
|
|
184
|
+
[[package]]
|
|
185
|
+
name = "pyo3-ffi"
|
|
186
|
+
version = "0.30.1"
|
|
187
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
188
|
+
checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
|
|
189
|
+
dependencies = [
|
|
190
|
+
"libc",
|
|
191
|
+
"pyo3-build-config",
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
[[package]]
|
|
195
|
+
name = "pyo3-macros"
|
|
196
|
+
version = "0.30.1"
|
|
197
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
198
|
+
checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
|
|
199
|
+
dependencies = [
|
|
200
|
+
"proc-macro2",
|
|
201
|
+
"pyo3-macros-backend",
|
|
202
|
+
"quote",
|
|
203
|
+
"syn",
|
|
204
|
+
]
|
|
205
|
+
|
|
206
|
+
[[package]]
|
|
207
|
+
name = "pyo3-macros-backend"
|
|
208
|
+
version = "0.30.1"
|
|
209
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
210
|
+
checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
|
|
211
|
+
dependencies = [
|
|
212
|
+
"heck",
|
|
213
|
+
"proc-macro2",
|
|
214
|
+
"quote",
|
|
215
|
+
"syn",
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
[[package]]
|
|
219
|
+
name = "quote"
|
|
220
|
+
version = "1.0.47"
|
|
221
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
222
|
+
checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
|
|
223
|
+
dependencies = [
|
|
224
|
+
"proc-macro2",
|
|
225
|
+
]
|
|
226
|
+
|
|
227
|
+
[[package]]
|
|
228
|
+
name = "rawpointer"
|
|
229
|
+
version = "0.2.1"
|
|
230
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
231
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
232
|
+
|
|
233
|
+
[[package]]
|
|
234
|
+
name = "rayon"
|
|
235
|
+
version = "1.12.0"
|
|
236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
237
|
+
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
|
238
|
+
dependencies = [
|
|
239
|
+
"either",
|
|
240
|
+
"rayon-core",
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "rayon-core"
|
|
245
|
+
version = "1.13.0"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
|
248
|
+
dependencies = [
|
|
249
|
+
"crossbeam-deque",
|
|
250
|
+
"crossbeam-utils",
|
|
251
|
+
]
|
|
252
|
+
|
|
253
|
+
[[package]]
|
|
254
|
+
name = "rustc-hash"
|
|
255
|
+
version = "2.1.3"
|
|
256
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
257
|
+
checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
258
|
+
|
|
259
|
+
[[package]]
|
|
260
|
+
name = "syn"
|
|
261
|
+
version = "3.0.10"
|
|
262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
263
|
+
checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
|
|
264
|
+
dependencies = [
|
|
265
|
+
"proc-macro2",
|
|
266
|
+
"quote",
|
|
267
|
+
"unicode-ident",
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
[[package]]
|
|
271
|
+
name = "target-lexicon"
|
|
272
|
+
version = "0.13.5"
|
|
273
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
274
|
+
checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
|
|
275
|
+
|
|
276
|
+
[[package]]
|
|
277
|
+
name = "unicode-ident"
|
|
278
|
+
version = "1.0.27"
|
|
279
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
280
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "fastauc"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
rust-version = "1.85"
|
|
6
|
+
description = "Fast, multithreaded classification, calibration and ranking metrics for Python"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
repository = "https://github.com/hen-ml/fastauc"
|
|
10
|
+
authors = ["Ming-Hen Tsai"]
|
|
11
|
+
publish = false
|
|
12
|
+
|
|
13
|
+
[lib]
|
|
14
|
+
name = "_core"
|
|
15
|
+
crate-type = ["cdylib"]
|
|
16
|
+
|
|
17
|
+
[dependencies]
|
|
18
|
+
# abi3-py39: one wheel per platform covers every CPython >= 3.9.
|
|
19
|
+
pyo3 = { version = "0.30", features = ["abi3-py39"] }
|
|
20
|
+
numpy = "0.30"
|
|
21
|
+
rayon = "1.10"
|
|
22
|
+
|
|
23
|
+
[profile.release]
|
|
24
|
+
opt-level = 3
|
|
25
|
+
lto = "fat"
|
|
26
|
+
codegen-units = 1
|
|
27
|
+
strip = "symbols"
|
pyfastauc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ming-Hen Tsai
|
|
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.
|