ECOD

Also known as: Empirical cumulative distribution-based outlier detection

On this page 7

ECOD (Empirical cumulative distribution-based outlier detection) is an unsupervised outlier detection algorithm that scores each data point by estimating how unlikely its feature values are in the tails of each feature’s empirical distribution. In anomaly detection, ECOD is valued as a fast, parameter-free and interpretable baseline that works on tabular data with many rows and dimensions.

The method was introduced in 2022 by researchers who also maintain the PyOD library, where it is available as a standard detector. Its central idea is simple: outliers are rare events that sit in the extreme left or right tail of one or more features, and empirical cumulative distribution functions measure that rarity without assuming any parametric distribution.

How ECOD scores outliers

ECOD works one dimension at a time. For every feature, it builds the empirical cumulative distribution function (ECDF) from the training data, which gives the share of observations at or below each value. It also builds the reverse ECDF, which gives the share at or above each value.

For each point and each feature, ECOD reads a left-tail probability and a right-tail probability from these functions. A very small tail probability means the value is extreme. The algorithm converts these probabilities to negative log values and sums them across features, so that several moderately unusual features and one extremely unusual feature both raise the score.

ECOD then accounts for skewness. For a feature skewed to the right, it uses the right tail; for a left-skewed feature, the left tail. The final anomaly score is the maximum of three aggregates: the left-tail sum, the right-tail sum and the skewness-corrected sum. Higher scores indicate stronger outliers.

The table below summarizes the main steps of the algorithm and what each step contributes.

StepOperationPurpose
Estimate ECDFsSort values per featureDescribe each distribution without assumptions
Compute tail probabilitiesRead left and right ECDF valuesMeasure extremeness per feature
Apply skewness correctionPick the tail matching the skewFocus on the tail where outliers occur
AggregateSum negative log probabilitiesCombine evidence across features
Take the maximumChoose the largest of three sumsProduce one final outlier score
Steps of the ECOD algorithm

Key properties of ECOD

ECOD is designed to be a practical default detector rather than a highly tuned model. Its properties make it attractive when labels are absent and data volumes are large.

PropertyValue or behaviorPractical effect
HyperparametersNone in the core methodNo tuning without labels
Time complexityRoughly linear in rows times featuresScales to millions of rows
Distribution assumptionNone, nonparametricWorks with skewed or heavy-tailed features
OutputContinuous anomaly scoreRanking plus thresholding by contamination rate
InterpretabilityPer-feature contributionsExplains which features drove a score
Main properties of ECOD

Because the score is a sum of per-feature terms, an analyst can plot each feature’s contribution for a flagged point. This dimensional outlier graph shows exactly which measurements were extreme, which supports anomaly explanation in audits and incident reviews.

In practice, the decision threshold comes from a contamination rate, the expected share of outliers. PyOD converts this rate into a score cutoff, so the analyst controls how many points are flagged without changing the scoring itself.

ECOD compared with other detectors

ECOD belongs to the family of probabilistic, per-dimension detectors, together with COPOD and the histogram-based outlier score. It differs from distance-based and tree-based methods in what kind of anomaly it can see.

MethodCore ideaStrengthWeakness
ECODTail probabilities from ECDFsFast, parameter-free, interpretableIgnores feature interactions
COPODEmpirical copula tail probabilitiesSimilar speed and interpretabilitySimilar independence limits
HBOSHistogram density per featureVery fastSensitive to bin width
Isolation forestRandom splits isolate outliersCaptures some interactionsRandom variation between runs
Local outlier factorLocal density versus neighborsFinds local anomaliesSlow on large data, needs k
ECOD and related anomaly detection methods

In published benchmark studies, ECOD performs competitively with far more complex detectors on many tabular datasets, but no single method wins everywhere. It is strongest when anomalies show up as extreme values in individual features, and weaker when they appear only as unusual combinations of ordinary values.

When and how to apply ECOD

ECOD is a sensible first detector to try on tabular data, either alone or as one member of an ensemble. The decision table below shows where it fits well and where another method should complement it.

SituationRecommendationReason
Large tabular data, no labelsUse ECOD as a baselineNo tuning and linear cost
Need to explain each alertPrefer ECODPer-feature scores are readable
Anomalies in feature combinationsAdd isolation forest or an autoencoderECOD treats features independently
Clustered data with local outliersAdd local outlier factorECOD uses global distributions
Time series with seasonalityUse time series methodsECOD ignores temporal order
Fit of ECOD by situation

Good practice includes removing identifiers and constant columns, encoding categories carefully and checking whether heavily discrete features create many ties. Combining ECOD scores with those of a structurally different detector, after normalizing the scores, often gives more robust rankings than either detector alone.

Limitations and common mistakes

The main limitation follows from its design: ECOD assumes that dimensions can be scored independently. A transaction with a normal amount and a normal location can still be fraudulent if that combination is rare, and ECOD will miss such interaction anomalies.

  • Feeding highly correlated duplicate features, which counts the same evidence several times.
  • Using it on raw time series values, where order and seasonality carry the signal.
  • Treating the contamination rate as a known fact instead of a business assumption to validate.
  • Training on data already dominated by anomalies, which shifts the empirical tails.
  • Expecting it to find local outliers inside dense clusters, which global tails cannot reveal.

In plain words

ECOD finds unusual records by checking how extreme each value is. It looks at one measurement at a time. For example, it asks how rare a purchase amount is compared with all other purchases. Then it asks the same for the next measurement.

Records with several rare values, or one very rare value, get a high strangeness score. Think of a teacher who flags a student only when test results fall far outside the class range. The method needs no settings and runs fast. It can miss oddities that only appear when two normal values are combined.

A real-world example

A data team at a mid-sized online retailer monitors about 2 million orders per month for suspicious activity. Each order has around 30 numeric features, such as basket value, item count, shipping distance and minutes since account creation. Labels are scarce, so the team needs an unsupervised detector that runs nightly without tuning.

The team runs ECOD from PyOD with a contamination rate of 0.5 percent, which flags roughly 10,000 orders per month for review. Scoring the full monthly set takes only minutes on a single server. For each flagged order, reviewers see the per-feature contribution chart, which shows, for instance, that an extremely new account and an unusually long shipping distance drove the score. To catch combination patterns, the team adds an isolation forest and reviews orders ranked high by either model, which reduces missed fraud cases compared with its earlier fixed rules.