Time series discord

Also known as: discord discovery

On this page 7

A time series discord is the subsequence of a given length whose distance to its nearest non-self match is the largest in the whole series. In anomaly detection, discord discovery provides a parameter-light definition of an unusual shape: the segment that looks least like anything else in the data.

The concept was introduced in 2005 together with the HOT SAX search algorithm, and it has since become one of the most reliable baselines for time series anomaly detection. Its appeal lies in needing only one main parameter, the subsequence length, and no training labels or model of normal behavior.

How a discord is defined

Discord discovery slides a window of length m across a series of length n and treats every window as a candidate subsequence. For each candidate, it finds the closest other subsequence, excluding trivial matches that overlap the candidate itself; the distance to that closest match is the candidate’s nearest-neighbor distance.

The top discord is the candidate with the maximum nearest-neighbor distance. Extensions define the top-k discords as the k largest such distances with non-overlapping locations, and the k-th nearest-neighbor discord, which uses the distance to the k-th match to resist repeated anomalies.

Most modern work measures similarity with the z-normalized Euclidean distance, which compares shapes regardless of offset and amplitude. The exclusion zone that removes trivial matches is usually set to between m/4 and m/2 samples on each side of the candidate.

The core quantities used to define and rank discords are listed below.

QuantityMeaningTypical setting
Subsequence length mWidth of the pattern being comparedOne period or event duration
Exclusion zoneRegion ignored as trivial matchesm/4 to m/2 samples
Distance measureHow shapes are comparedz-normalized Euclidean
Nearest-neighbor distanceGap to the closest non-self matchDiscord score
Number of discords kHow many anomalies to report1 to 10 in practice
Quantities in the discord definition

Algorithms for discord discovery

A brute-force search compares every pair of subsequences and costs O(n squared times m) operations, which becomes impractical for long series. Practical algorithms either prune candidates early or compute all nearest-neighbor distances at once with fast exact methods.

HOT SAX orders candidates with a symbolic SAX representation so that likely discords are examined first and ordinary ones are abandoned as soon as a close match appears. Later methods compute the matrix profile, whose maximum value directly marks the top discord, and newer algorithms extend the search to all lengths or to streaming data.

The following table compares the best-known algorithms and their intended use.

AlgorithmApproachStrengthLimitation
Brute forceAll-pairs comparisonExact and simpleQuadratic cost
HOT SAXSymbolic ordering with early abandoningFast on typical dataSensitive to SAX parameters
DRAGRange-based disk-aware pruningHandles data larger than memoryNeeds a distance threshold
Matrix profile methodsExact all-subsequence nearest neighborsGives all scores at onceFixed length per run
MERLINEfficient search over a length rangeRemoves guessing of mMore computation per range
DAMPOnline left-discord searchStreaming and very long seriesOnly looks at past data
Main discord discovery algorithms

How discords relate to other anomaly types

A discord is a subsequence anomaly, so it captures unusual shapes rather than single extreme values. It overlaps with the classic categories of point, contextual and collective anomalies, but it does not map neatly onto any one of them.

ConceptWhat is unusualDetected by discords
Point anomalyA single extreme valueOnly if it distorts the local shape
Contextual anomalyA normal value at the wrong timeOften, when the window covers the context
Collective anomalyA sequence that is abnormal as a wholeYes, this is the main target
Change pointA lasting shift in behaviorOnly the transition, not the new regime
Forecast residual anomalyDeviation from a model predictionDifferent method, often complementary
Discords compared with related anomaly concepts

Compared with forecasting-based anomaly detection or deep models such as the Anomaly Transformer, discords need no training phase and no learned model. Benchmark studies have repeatedly found that simple discord baselines remain competitive with far more complex neural methods on many univariate datasets.

Choosing parameters in practice

The subsequence length is the decision that matters most. It should match the duration of the expected anomalous event or one natural cycle of the signal, such as a heartbeat, a machine cycle or a day of sensor readings.

The decision table below links common situations to parameter choices.

SituationRecommended settingReason
Clear periodic signalm equal to one periodCompares whole cycles
Unknown event durationSearch a range of lengthsAvoids missing short or long events
Repeated identical faultsUse the k-th nearest neighborPrevents twin anomalies hiding each other
Continuous monitoringOnline left-discord searchScores each point as it arrives
Amplitude mattersSkip z-normalizationKeeps level differences visible
Parameter choices for common situations

Thresholding is a separate step. A discord score is a relative ranking, so operational systems either report the top few discords for review or compare scores against a dynamic threshold learned from historical values.

Limitations and common pitfalls

The definition is elegant but has well-known blind spots. Each one follows from the rule that a discord must be far from its single nearest match.

  • Twin freak problem: two similar anomalies match each other and both receive low scores.
  • Wrong window length: a window far shorter or longer than the event dilutes the anomaly.
  • Flat or noisy segments: z-normalizing near-constant data amplifies noise into false discords.
  • Multivariate data: a single-channel definition misses anomalies spread across sensors.
  • Always one winner: every series has a top discord, even when nothing is truly abnormal.

The last point is the most frequent misunderstanding. A top discord is only a candidate, and its score must be compared with the normal range of scores before anyone treats it as a real fault.

The idea in brief

Picture a long recording of a heartbeat. Almost every beat looks like many other beats. Now cut the recording into short pieces and find, for each piece, its most similar partner.

The piece whose best partner is still a poor match is the discord. It is the part of the recording that has no look-alike. That makes it the most likely place where something unusual happened. No one has to teach the method what normal looks like, because normal is simply what repeats.

A practical scenario

A reliability engineer at a water utility monitors a pump station that records motor current every second. A normal pumping cycle lasts about 90 seconds, and a month of data contains roughly 2.6 million readings.

The engineer computes the matrix profile with a subsequence length of 90 samples and reviews the top five discords. Four correspond to scheduled maintenance stops, which are recorded in the work log. The fifth is a cycle with a brief current spike followed by a slow decay, a shape that appears nowhere else in the month.

Inspection reveals a partially blocked impeller that caused the motor to strain at start-up. The pump is cleaned during the next planned shutdown, and the utility avoids an unplanned outage. The team then adds the k-th neighbor variant so that repeated blockages would not mask each other.