ecod-rs

The ECOD outlier detector (Li et al., 2022) in Rust, with Python bindings.

Install

Requires Python 3.12+.

pip install ecod-rs

Quick start

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)       # (n, 2): [inlier, outlier]

model.save("model.bin")
model = InductiveECOD.load("model.bin")

ECOD vs InductiveECOD

Both classes have the same interface. They differ in what a score depends on.

InductiveECODECOD
fitSorts every feature of the training data and stores it.Same.
ScoringEach sample is compared with the training data only. Its score does not depend on the rest of the batch.The batch is merged with the training data and every distribution is rebuilt, as in PyOD. A sample's score depends on the whole batch.
Use whenScoring new data in production, one sample or many.You need numbers that match PyOD.

In PyOD, fit only stores the data, so its ECOD is always transductive (see PyOD issues #401 and #426). InductiveECOD is the variant PyOD does not have.

Constructor

InductiveECOD(contamination=0.1, method="max", n_jobs=1)
ECOD(contamination=0.1, method="max", n_jobs=1)
ParameterDefaultDescription
contamination0.1Expected share of outliers, in (0, 0.5]. Only predict uses it, see predict.
method"max"One of "max", "pyod-max", "left", "right", "auto". How per-feature tail probabilities are combined into a score, see Score methods.
n_jobs1Number of threads. 0 uses all cores. See Parallelism.

How scores are computed

ECOD looks at every feature separately. For a value it asks how rare it is in the left tail (values this low or lower) and in the right tail (values this high or higher), then adds the negative logs over all features. Notation: the training data has n rows and d features, xij is feature j of training row i, and x=(x1,…,xd) is the sample being scored.

Tail probabilities

InductiveECOD counts training values only. One is added to the count and to the total, so a value outside the training range gets a small probability instead of zero:

Lj(v)= #{i:xij≤v}+1 n+1 Rj(v)= #{i:xij≥v}+1 n+1

ECOD counts over Zj, the training values of feature j together with the batch being scored, N=n+m values in total for a batch of m rows. The sample itself is in Zj, so the counts are at least one:

Lj(v)= #{z∈Zj:z≤v} N Rj(v)= #{z∈Zj:z≥v} N

Skewness

The "auto" and "max" methods pick a tail per feature by the sign of its sample skewness. InductiveECOD computes it on the training data at fit, ECOD on Zj for every batch:

γj= m3m23/2 , mk= 1n ∑i=1n (xij−x¯j)k

A constant feature has m2=0 and gets γj=0.

Tail scores

Three sums over features: left tail, right tail, and the tail picked by skewness.

OL(x)=− ∑j=1d lnLj(xj) OR(x)=− ∑j=1d lnRj(xj)
OA(x)=− ∑j=1d lnTj(xj) , Tj= { Rjif γj≥0 Ljotherwise

Tail probabilities are at most 1, so all scores are non-negative. With one tail, a normal sample scores about d on average, because −lnU of a uniform value averages 1. The "max" and "pyod-max" methods give higher numbers on the same data. A sample that sits in the tails of many features scores much higher than any of these.

Score methods

The method parameter picks the final score O(x):

methodScoreWhen to use
"max" max(OL,OR,OA) Default, as in the paper. The maximum is taken over the three whole sums.
"pyod-max" −∑j=1dlnmin(Lj,Rj) Reproduces PyOD's numbers. PyOD takes the maximum per feature, before summing, which is always at least the paper's score.
"left" OL Only unusually low values matter.
"right" OR Only unusually high values matter, for example latencies or amounts.
"auto" OA One tail per feature, the long one.

Scores, labels and probabilities

A fitted model gives three kinds of output for the same samples. All three come from the same score O(x); they differ in what they add on top of it.

decision_functionpredictpredict_proba(method="linear")predict_proba(method="unify")
ReturnsScore, a float >= 0Label, 0 or 1[inlier, outlier], floats in [0, 1][inlier, outlier], floats in [0, 1]
Uses contaminationNoYes, sets the thresholdNoNo
Uses training scoresNoTheir percentileTheir min and maxTheir mean and std
Keeps the order of scores-Only above or below the thresholdYes, until clipped at 0 or 1Yes, until clipped at 0 or 1
Good forRanking samples, ROC AUC, your own thresholdA yes/no decision at a known outlier rateComparing scores on a fixed scaleCalibrated-looking probabilities, as in PyOD

At fit, the model scores its own training data once and stores four numbers from those training scores: the threshold, the minimum and maximum, and the mean and standard deviation. predict and predict_proba compare new scores with them.

decision_function

Returns O(x) for every row, nothing else. Higher means more anomalous. This is the output to use for ranking and for metrics such as ROC AUC, since it loses no information.

predict

The threshold t is the 100(1−c)-th percentile of the training scores, where c is contamination. The percentile uses linear interpolation, like numpy.percentile by default. A row is an outlier when its score is above the threshold:

y^(x)= { 1if O(x)>t 0otherwise

So on the training data about a share c of rows is labelled 1. On new data the share can be anything: it is the share of rows that score above the training percentile. contamination does not change scores or probabilities, only this threshold.

predict_proba

Turns the score into an outlier probability p and returns [1−p,p] per row, an array of shape (n_samples, 2) like in PyOD and scikit-learn. Both methods clip p to [0,1]. With Omin, Omax, μ and σ the minimum, maximum, mean and standard deviation of the training scores:

plinear= O(x)−Omin Omax−Omin punify= erf( O(x)−μ σ2 )

predict and predict_proba can disagree

predict uses the contamination threshold, predict_proba does not. A row labelled 1 can have an outlier probability below 0.5, and the other way round. In a quick check with 500 training and 50 test rows of normal noise, predict_proba(x)[:, 1] > 0.5 differed from predict(x) on 4 rows. If you need labels, use predict; if you need your own cut-off, threshold decision_function.

ECOD and the batch

For ECOD all three outputs depend on the batch, because the score does. The same row gets a different score, label and probability when scored alone and when scored together with other rows. The stored training statistics stay fixed, so only the score side moves.

Scoring the training data again with ECOD.decision_function(X_train) gives the same scores as fit: merging the data with a copy of itself doubles every count and the total, so the ratios do not change. These are also the numbers PyOD stores in decision_scores_ with method="pyod-max".

InductiveECOD has none of this: a row gets the same output alone or in any batch.

Methods

fit(x) -> self

Fits the model on x of shape (n_samples, n_features) and returns the model itself, so calls can be chained.

decision_function(x) -> list[float]

Score of each row. See decision_function.

predict(x) -> list[int]

Label of each row, 1 for outliers. See predict.

predict_proba(x, method="linear") -> list[[float, float]]

[inlier, outlier] probabilities of each row, method is "linear" or "unify". See predict_proba.

save(path, *, compression_level=None)

Writes the fitted model to a file. See Saving and loading.

load(path, *, n_jobs=1) -> model

Static method. Reads a model saved by the same class.

For every method that takes x, it must have the same number of features as the training data.

Input data

Parallelism

n_jobs sets the number of threads for fit, decision_function, predict and predict_proba.

Scores are bit-identical for any n_jobs. Each model keeps its own thread pool for its lifetime. The GIL is released during computation, so Python threads can run other work in parallel.

On 100,000 rows and more, all cores are 4 to 7 times faster than one thread. Around 10,000 rows it is about 2 times faster, and for tiny inputs starting the pool in the constructor costs more than it saves. See the benchmark.

Saving and loading

model.save("model.bin")                         # zstd level 3
model.save("model.bin", compression_level=19)   # smaller file, slower save
model = InductiveECOD.load("model.bin", n_jobs=0)

Errors

ExceptionWhen
ValueErrorInvalid contamination, method or n_jobs; empty input; rows of different lengths; NaN or inf in the input; wrong number of features passed to a fitted model; a model file that cannot be decoded or fails the checks.
RuntimeErrorCalling decision_function, predict, predict_proba or save before fit; zstd failing to compress or decompress.
OSErrorFile errors in save and load, such as FileNotFoundError or PermissionError.

Benchmark

ecod-rs compared with ECOD from PyOD.

Data is random normal noise of several sizes (rows x features) and the classical datasets from ADBench. Each dataset is split 60/40 into train and test. Every measurement runs in a fresh process, times are taken over 5 runs. All tables except Parallelism use one thread: n_jobs=1 for both libraries.

What is measured:

Summary

How many times ecod-rs is faster than pyod-ECOD: median over all 53 datasets, the range in brackets. Below 1 means slower.

phasevarianttimes faster than pyod-ECOD
ECODInductiveECOD
fit4.3x (2.3x to 11.3x)4.3x (2.2x to 10.7x)
score7.7x (3.9x to 26.7x)10.7x (5.8x to 39.7x)
pipeline5.7x (2.7x to 18.1x)6.6x (3.2x to 19.8x)
savedefault2.4x (0.4x to 5.3x)2.3x (0.4x to 5.3x)
savecompressed1.7x (0.3x to 19.3x)1.7x (0.3x to 18.1x)
loaddefault2.7x (0.5x to 4.0x)2.7x (0.5x to 4.2x)
loadcompressed24.6x (4.7x to 105.5x)24.9x (4.3x to 108.9x)

Speed

Median time in seconds. In brackets, how many times faster than pyod-ECOD. PyOD has no separate convert step.

datasetfit, sscore, spipeline, sconvert, s
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECOD
1000x100.0005315 (3.1x)0.0005719 (2.9x)0.001670.0004201 (4.3x)0.0002783 (6.4x)0.0017950.0009592 (3.0x)0.0007912 (3.7x)0.002920.00012780.0001273
10000x100.003823 (2.3x)0.003394 (2.5x)0.0086340.002972 (4.8x)0.002029 (7.0x)0.014160.006267 (3.7x)0.004784 (4.9x)0.023290.00012880.0001476
100000x100.03551 (2.9x)0.03621 (2.9x)0.10440.03009 (6.1x)0.0157 (11.7x)0.18330.06694 (4.3x)0.05167 (5.5x)0.28640.00012980.0001327
1000000x100.4118 (3.6x)0.4117 (3.6x)1.50.3141 (8.1x)0.177 (14.4x)2.5460.7523 (5.4x)0.5904 (6.8x)4.0360.0001410.0001601
10000x1000.03111 (2.8x)0.03004 (2.8x)0.085570.02799 (5.1x)0.01417 (10.0x)0.14140.059 (3.9x)0.04392 (5.2x)0.23040.00015760.0001554
100000x1000.3506 (3.5x)0.3378 (3.6x)1.2280.3004 (7.2x)0.1561 (13.8x)2.1590.6526 (5.2x)0.4928 (6.9x)3.3840.00013860.0001484
ADBench datasets
datasetfit, sscore, spipeline, sconvert, s
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECOD
1_ALOI0.02566 (6.3x)0.02615 (6.2x)0.16290.02053 (14.7x)0.01349 (22.4x)0.30160.04615 (10.3x)0.03959 (12.0x)0.47320.00012590.0001496
2_annthyroid0.001216 (3.7x)0.0009853 (4.5x)0.0044730.0008928 (7.6x)0.0006369 (10.7x)0.0068150.001903 (5.8x)0.001485 (7.4x)0.010980.00013490.0001438
3_backdoor0.2502 (10.8x)0.2516 (10.7x)2.6940.2203 (21.5x)0.1223 (38.8x)4.7450.4755 (15.6x)0.3852 (19.3x)7.4220.00016010.0001629
4_breastw0.0002925 (4.8x)0.0002917 (4.8x)0.0013940.00018 (8.7x)0.0001561 (10.0x)0.0015680.0004111 (6.4x)0.0003836 (6.8x)0.0026140.00013430.0001657
5_campaign0.03005 (10.7x)0.03065 (10.5x)0.32120.02175 (26.7x)0.01582 (36.7x)0.58120.05091 (18.1x)0.04641 (19.8x)0.91960.00016360.0001396
6_cardio0.001143 (3.4x)0.001194 (3.3x)0.0039420.0008923 (6.5x)0.0006305 (9.2x)0.0058120.001681 (5.5x)0.001596 (5.8x)0.0092660.00014280.0001607
7_Cardiotocography0.001096 (3.9x)0.001044 (4.1x)0.0042980.0009031 (7.4x)0.0006389 (10.4x)0.0066730.001763 (6.0x)0.001756 (6.1x)0.010640.00016440.0001561
8_celeba0.1257 (7.4x)0.1291 (7.2x)0.93380.1055 (15.8x)0.05969 (28.0x)1.6710.2316 (11.3x)0.1744 (15.0x)2.6120.000150.000139
9_census2.294 (11.3x)2.834 (9.1x)25.851.792 (24.6x)1.113 (39.6x)44.044.129 (16.3x)3.746 (18.0x)67.340.00014930.0001468
10_cover0.05276 (6.8x)0.05231 (6.8x)0.35640.03673 (17.5x)0.02445 (26.3x)0.64230.08875 (11.3x)0.07566 (13.3x)1.0040.00016590.000146
11_donors0.09409 (8.3x)0.09494 (8.3x)0.78360.06604 (25.5x)0.04249 (39.7x)1.6860.1766 (14.1x)0.145 (17.2x)2.4970.00014130.0001607
12_fault0.001646 (2.8x)0.001582 (2.9x)0.0045540.001433 (5.3x)0.001008 (7.6x)0.0076280.002573 (4.4x)0.002319 (4.9x)0.011350.00014140.000144
13_fraud0.3173 (3.9x)0.3217 (3.8x)1.2320.2602 (8.2x)0.1426 (15.0x)2.1410.5858 (5.8x)0.453 (7.5x)3.390.00013570.0001305
14_glass0.0002099 (4.6x)0.000219 (4.4x)0.00096080.00009149 (9.2x)0.0001093 (7.7x)0.00084440.0003033 (4.9x)0.0002557 (5.8x)0.0014890.00014920.0001597
15_Hepatitis0.0001928 (5.0x)0.0002041 (4.7x)0.00095850.0001277 (6.4x)0.0001073 (7.6x)0.00082050.0002712 (5.5x)0.0002332 (6.4x)0.0014980.00014540.0001592
16_http0.03185 (8.1x)0.03207 (8.0x)0.25720.02393 (19.6x)0.01936 (24.3x)0.46960.0671 (11.0x)0.04895 (15.1x)0.73690.00015970.0001556
17_InternetAds0.03949 (9.1x)0.0402 (9.0x)0.3610.02643 (24.1x)0.01937 (32.9x)0.63710.06324 (16.0x)0.05571 (18.2x)1.0140.00013840.0001522
18_Ionosphere0.0005413 (2.6x)0.000537 (2.6x)0.0013880.0004194 (4.1x)0.0002927 (5.9x)0.0017250.0009219 (3.0x)0.0008246 (3.3x)0.0027240.0001610.0001527
19_landsat0.00352 (5.2x)0.004246 (4.4x)0.018470.002869 (11.3x)0.002217 (14.6x)0.032440.006125 (9.2x)0.005312 (10.6x)0.056350.00015150.0001528
20_letter0.000975 (4.8x)0.001073 (4.3x)0.0046420.0007548 (8.7x)0.0005904 (11.1x)0.0065560.00158 (7.0x)0.001611 (6.8x)0.011020.00015480.0001294
21_Lymphography0.000211 (5.0x)0.0002053 (5.1x)0.0010470.0001328 (7.4x)0.0001172 (8.4x)0.00098070.000308 (5.7x)0.0002656 (6.6x)0.0017620.00014810.0001395
22_magic.gamma0.006157 (2.7x)0.006313 (2.7x)0.016820.005067 (5.7x)0.003156 (9.1x)0.028870.01101 (4.6x)0.008877 (5.7x)0.050590.00015380.0001392
23_mammography0.001658 (4.6x)0.00157 (4.9x)0.0076460.001327 (9.2x)0.0009941 (12.3x)0.01220.002577 (8.0x)0.002388 (8.6x)0.020520.00013360.000147
24_mnist0.009274 (7.4x)0.009419 (7.3x)0.068870.007249 (16.8x)0.005297 (23.1x)0.12210.01621 (12.6x)0.01391 (14.7x)0.20430.00015610.0001643
25_musk0.01084 (3.3x)0.01071 (3.3x)0.035390.008963 (8.3x)0.005603 (13.3x)0.07430.01946 (6.2x)0.01652 (7.3x)0.12050.00014550.0001549
26_optdigits0.004477 (6.6x)0.00399 (7.4x)0.02940.0033 (15.8x)0.002686 (19.5x)0.052290.00722 (12.6x)0.006128 (14.9x)0.091180.00013830.0001395
27_PageBlocks0.001744 (3.1x)0.002065 (2.6x)0.0053530.001549 (5.5x)0.001017 (8.3x)0.0084590.003273 (4.2x)0.002347 (5.9x)0.01380.00013670.0001573
28_pendigits0.003318 (2.9x)0.003131 (3.1x)0.009640.00258 (6.2x)0.001814 (8.9x)0.016080.005783 (4.7x)0.004654 (5.8x)0.0270.00016010.0001585
29_Pima0.000348 (3.7x)0.0003688 (3.5x)0.0012970.0002529 (5.6x)0.0001918 (7.3x)0.0014080.0005971 (4.1x)0.0004978 (4.9x)0.0024570.000150.0001551
30_satellite0.003673 (4.7x)0.003667 (4.7x)0.017290.003125 (10.4x)0.002159 (15.1x)0.032520.006303 (8.9x)0.00553 (10.1x)0.056080.00014620.0001398
31_satimage-20.003177 (5.1x)0.003303 (4.9x)0.016150.002849 (10.0x)0.001951 (14.6x)0.02840.005586 (8.8x)0.004752 (10.4x)0.049420.00016440.0001566
32_shuttle0.005558 (8.3x)0.00611 (7.5x)0.045930.004434 (19.6x)0.003482 (25.0x)0.0870.009897 (14.7x)0.008737 (16.7x)0.1460.00013320.0001331
33_skin0.0125 (6.8x)0.01244 (6.8x)0.084810.009144 (16.1x)0.007109 (20.7x)0.14710.02667 (9.3x)0.01964 (12.6x)0.24710.00015340.0001407
34_smtp0.005404 (5.5x)0.005841 (5.1x)0.029850.004179 (13.7x)0.002989 (19.2x)0.057390.01104 (8.4x)0.008255 (11.2x)0.092770.00014010.0001456
35_SpamBase0.004272 (6.0x)0.003894 (6.6x)0.025730.003121 (15.6x)0.002025 (24.1x)0.048720.006433 (12.7x)0.005773 (14.1x)0.081470.00014420.0001334
36_speech0.04189 (2.6x)0.04211 (2.6x)0.11020.03511 (6.1x)0.02077 (10.3x)0.21330.07649 (4.6x)0.06242 (5.6x)0.35160.00015810.0001558
37_Stamps0.0002822 (3.8x)0.0002803 (3.8x)0.001060.0001876 (5.4x)0.0001398 (7.3x)0.0010150.0004576 (3.9x)0.0003734 (4.8x)0.0017920.00013740.0001459
38_thyroid0.0007609 (3.7x)0.0007694 (3.7x)0.0028160.000557 (7.2x)0.0003719 (10.9x)0.0040350.001279 (5.1x)0.001122 (5.9x)0.0065760.00015720.0001312
39_vertebral0.0002272 (4.2x)0.0002263 (4.2x)0.00096110.0001359 (6.2x)0.0001132 (7.4x)0.00083620.0003065 (4.9x)0.0002624 (5.7x)0.0014890.0001590.0001412
40_vowels0.0008657 (2.3x)0.0009013 (2.2x)0.001980.0006683 (3.9x)0.0004288 (6.1x)0.0026020.001542 (2.7x)0.001295 (3.2x)0.0041790.00017090.0001426
41_Waveform0.002339 (2.6x)0.002667 (2.3x)0.0060380.002166 (4.5x)0.001435 (6.7x)0.0096710.004341 (3.4x)0.003633 (4.1x)0.014940.00014370.0001515
42_WBC0.0001952 (5.2x)0.0002114 (4.8x)0.0010160.0001196 (7.7x)0.0001074 (8.5x)0.00091530.0002839 (5.7x)0.0002598 (6.3x)0.0016240.00013840.0001434
43_WDBC0.0005823 (2.5x)0.0005833 (2.5x)0.0014670.0004626 (3.9x)0.0003041 (5.9x)0.0017930.0009953 (3.0x)0.0008422 (3.5x)0.0029680.0001490.0001586
44_Wilt0.001165 (2.5x)0.001024 (2.9x)0.0029420.0009445 (4.4x)0.0005989 (7.0x)0.0041770.001721 (4.0x)0.001748 (3.9x)0.0068510.00015490.0001658
45_wine0.0002256 (4.3x)0.0002281 (4.3x)0.00097290.0001447 (6.0x)0.0001163 (7.5x)0.00087030.000308 (4.9x)0.0002768 (5.4x)0.00150.00015840.0001606
46_WPBC0.0004005 (3.0x)0.0004293 (2.8x)0.0012150.0003016 (4.2x)0.0002177 (5.8x)0.0012720.0006609 (3.3x)0.0005729 (3.8x)0.0021750.00016650.0001597
47_yeast0.0004359 (4.3x)0.0004418 (4.3x)0.001890.0003013 (8.1x)0.0002342 (10.5x)0.0024510.0007134 (5.6x)0.0006608 (6.1x)0.0040120.00013530.0001503

Memory

How much the process memory peak grew during the run, in MB.

datasetfit, MBscore, MB
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECOD
1000x100.25780.257849.710.082030.011720.2812
10000x100.8750.87552.540.86720.15233.816
100000x106.9736.97373.128.4771.53145.29
1000000x1068.2168.41278.88221.41407.5
10000x1005.0044.92273.27.0740.12537.96
100000x10048.1848.26279.275.051.531412.8
ADBench datasets
datasetfit, MBscore, MB
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECOD
1_ALOI7.3677.44580.2710.430.605561.05
2_annthyroid0.55470.472749.710.35940.085942.727
3_backdoor87.8487.84476.8141.11.172770.7
4_breastw0.14840.234449.610.046880.0078120
5_campaign12.8212.8310819.680.5039116.6
6_cardio0.32810.328149.660.30080.019532.449
7_Cardiotocography0.44530.363349.890.34770.019532.719
8_celeba40.7940.46229.260.272.793327.4
9_census692691.4347611424.1176164
10_cover19.7519.83111.324.023.504130.5
11_donors42.2942.49192.647.978.684282.7
12_fault0.47270.472749.810.41020.023443.023
13_fraud44.144.34239.963.13.918338.6
14_glass0.11720.117249.480.015620.0039060
15_Hepatitis0.11720.199249.550.0156200
16_http20.9720.9783.0715.616.94975.1
17_InternetAds14.2614.26120.123.360.02344116.6
18_Ionosphere0.1680.2549.440.085940.0039060.457
19_landsat1.3161.39851.891.7970.078128.836
20_letter0.38280.464850.040.39840.019532.969
21_Lymphography0.19920.199249.50.027340.0039060
22_magic.gamma1.4141.49651.811.5940.22668.582
23_mammography0.75390.66850.820.56250.13673.074
24_mnist3.7663.84867.395.8360.0898428.83
25_musk2.5982.60261.833.8910.0312519.04
26_optdigits1.7581.76257.712.570.0585912.25
27_PageBlocks0.48050.476649.770.44920.06253.094
28_pendigits0.85160.765651.120.87110.082034.195
29_Pima0.23830.238349.530.046880.0078120.03125
30_satellite1.3981.31653.541.7970.0781210.53
31_satimage-21.1991.28151.861.6170.066417.969
32_shuttle3.3363.25858.523.5980.601619.95
33_skin9.1649.07865.366.7382.99632.45
34_smtp3.6723.5955.732.6171.16412.26
35_SpamBase1.3911.39152.061.8480.050789.105
36_speech6.9696.97383.9311.270.0429756.14
37_Stamps0.13280.128949.410.023440.0039060.0625
38_thyroid0.38280.382849.550.18360.042970.9727
39_vertebral0.11720.195349.430.015620.0039060
40_vowels0.30470.218849.380.14060.011720.7891
41_Waveform0.60160.519550.80.56640.035162.758
42_WBC0.11720.203149.50.015620.0039060
43_WDBC0.25390.171949.360.085940.0039060.4492
44_Wilt0.41410.328149.420.20310.054691.039
45_wine0.11330.199249.560.015620.0039060
46_WPBC0.21880.140649.50.054690.0039060
47_yeast0.27730.199249.520.089840.015620.4414

Saving and loading

datasetvariantsave, sload, sfile, MB
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECODpyod-ECOD
1000x10default0.0001355 (3.9x)0.0001396 (3.8x)0.00052430.0001317 (2.7x)0.0001415 (2.5x)0.00035260.043960.043970.2389
1000x10compressed0.001814 (2.7x)0.001866 (2.7x)0.004970.0001383 (11.4x)0.0001378 (11.5x)0.001580.043940.043950.09782
10000x10default0.0008743 (1.8x)0.0009051 (1.7x)0.0015370.0005385 (1.5x)0.0005146 (1.6x)0.00081590.43560.43562.381
10000x10compressed0.02267 (3.4x)0.02071 (3.7x)0.076760.000642 (24.7x)0.0006158 (25.8x)0.015890.42790.42721.633
100000x10default0.0135 (0.8x)0.0131 (0.8x)0.010830.005061 (1.8x)0.004639 (1.9x)0.0089074.1794.17923.8
100000x10compressed0.621 (1.7x)0.6344 (1.7x)1.0530.007224 (24.6x)0.007058 (25.1x)0.17753.7313.73121.61
1000000x10default0.1494 (0.8x)0.1502 (0.8x)0.11940.09162 (0.5x)0.09013 (0.5x)0.0424640.6140.61238
1000000x10compressed10.91 (1.0x)10.87 (1.0x)10.630.09703 (18.1x)0.09664 (18.2x)1.75830.6430.64223
10000x100default0.01238 (0.9x)0.01262 (0.9x)0.010860.004823 (1.7x)0.004753 (1.7x)0.0081844.3234.32322.98
10000x100compressed0.5138 (1.4x)0.5251 (1.4x)0.7210.005453 (28.2x)0.005203 (29.6x)0.15374.2814.28115.65
100000x100default0.1611 (0.9x)0.1607 (0.9x)0.14520.09305 (0.5x)0.09303 (0.5x)0.044241.7141.71229.8
100000x100compressed10.51 (1.0x)10.46 (1.0x)10.050.1175 (14.6x)0.1177 (14.6x)1.71437.3137.31211.4

Parallelism

Every library on all 16 cores: n_jobs=0 in ecod-rs, n_jobs=-1 in PyOD. Median time in seconds, in brackets how many times faster than the same library on one thread. Scores do not depend on the thread count.

datasetfit, sscore, spipeline, s
ECODInductiveECODpyod-ECODECODInductiveECODpyod-ECODECODInductiveECODpyod-ECOD
1000x100.0007993 (0.7x)0.0007854 (0.7x)0.01284 (0.1x)0.0003845 (1.1x)0.0002835 (1.0x)0.01272 (0.1x)0.001121 (0.9x)0.001039 (0.8x)0.02563 (0.1x)
10000x100.001744 (2.2x)0.001913 (1.8x)0.01669 (0.5x)0.001355 (2.2x)0.001076 (1.9x)0.01817 (0.8x)0.002786 (2.2x)0.002535 (1.9x)0.03453 (0.7x)
100000x100.007369 (4.8x)0.007774 (4.7x)0.06714 (1.6x)0.004925 (6.1x)0.002927 (5.4x)0.1022 (1.8x)0.01286 (5.2x)0.0104 (5.0x)0.1731 (1.7x)
1000000x100.09221 (4.5x)0.09768 (4.2x)0.7689 (2.0x)0.06469 (4.9x)0.03848 (4.6x)1.345 (1.9x)0.1638 (4.6x)0.133 (4.4x)2.091 (1.9x)
10000x1000.005323 (5.8x)0.005325 (5.6x)0.06085 (1.4x)0.003857 (7.3x)0.002779 (5.1x)0.09493 (1.5x)0.008996 (6.6x)0.00778 (5.6x)0.1559 (1.5x)
100000x1000.05691 (6.2x)0.05779 (5.8x)0.5902 (2.1x)0.05401 (5.6x)0.02512 (6.2x)1.042 (2.1x)0.1226 (5.3x)0.08547 (5.8x)1.65 (2.1x)

Quality

ROC AUC on the ADBench test part.

datasetROC AUC
ECODInductiveECODpyod-ECOD
1_ALOI0.52640.52620.5264
2_annthyroid0.7570.75420.757
3_backdoor0.84820.84860.8482
4_breastw0.99290.9920.9929
5_campaign0.76530.76520.7653
6_cardio0.92910.9270.9291
7_Cardiotocography0.78360.78530.7836
8_celeba0.74850.74860.7485
9_census0.66030.66080.6603
10_cover0.92380.92340.9238
11_donors0.88840.88790.8884
12_fault0.49750.50010.4975
13_fraud0.94640.94640.9464
14_glass0.78710.78710.7871
15_Hepatitis0.77140.78860.7714
16_http0.97870.97860.9787
17_InternetAds0.68330.6850.6833
18_Ionosphere0.73360.73540.7336
19_landsat0.38260.38530.3826
20_letter0.52060.51380.5206
21_Lymphography111
22_magic.gamma0.6350.6340.635
23_mammography0.92880.92950.9288
24_mnist0.74220.73910.7422
25_musk0.94920.94450.9492
26_optdigits0.59380.59850.5938
27_PageBlocks0.91160.90930.9116
28_pendigits0.92870.93010.9287
29_Pima0.60840.60420.6084
30_satellite0.59450.59660.5945
31_satimage-20.96360.96360.9636
32_shuttle0.99370.99380.9937
33_skin0.48850.48920.4885
34_smtp0.95360.95350.9536
35_SpamBase0.6730.67930.673
36_speech0.44810.44930.4481
37_Stamps0.87820.87760.8782
38_thyroid0.97750.97720.9775
39_vertebral0.28270.27680.2827
40_vowels0.56430.55070.5643
41_Waveform0.62880.62810.6288
42_WBC0.99230.99230.9923
43_WDBC0.95980.9510.9598
44_Wilt0.40180.39790.4018
45_wine0.430.40.43
46_WPBC0.440.42380.44
47_yeast0.43350.43270.4335