Time series classification

On this page 7

Time series classification is the machine learning task of assigning a discrete class label to a whole sequence of time-ordered observations. In artificial intelligence, it sits beside forecasting in the time series family: instead of predicting the next value, a classifier decides what kind of sequence it is, for example a normal or abnormal heartbeat, a walking or running motion, or a healthy or failing bearing.

The defining difficulty is that order and shape carry the information. Two sequences can share the same mean and variance yet belong to different classes because a peak appears earlier, a pattern repeats faster, or a local motif occurs only once. Good methods therefore capture temporal structure, not just summary statistics.

How time series classification works

Time series classification works by mapping each input sequence, often of length tens to tens of thousands of points, to a representation in which classes become separable, and then applying a decision rule. The input may be univariate, with one channel such as temperature, or multivariate, with several synchronized channels such as the three axes of an accelerometer.

A typical pipeline has four stages: preprocessing (resampling, z-normalization, handling missing values), representation (raw values, distances, extracted features or learned embeddings), classification (a nearest-neighbor rule, a linear model, a tree ensemble or a neural network) and evaluation on held-out sequences. The table below lists the main configuration choices and what they affect.

ChoiceTypical optionsWhat it affects
NormalizationPer-series z-score, noneSensitivity to offset and scale
Sequence lengthFixed, padded, variableModel compatibility and cost
Channel handlingIndependent, jointAbility to use cross-channel patterns
Window or segment sizeWhole series, sliding windowsGranularity of the label
Evaluation splitBy recording, by subjectRealism of the accuracy estimate
Key design choices in a classification pipeline

Main families of classification methods

Methods for time series classification fall into several families that differ in how they extract discriminative structure. Benchmark studies on the UCR and UEA archives, which contain more than one hundred univariate and about thirty multivariate datasets, have shaped the field and the standard comparisons.

FamilyCore ideaRepresentative methods
Distance-basedCompare whole series with an elastic distance1-NN with dynamic time warping
Interval-basedSummarize random time intervalsTime Series Forest, DrCIF
Shapelet-basedFind short subsequences that mark a classShapelet Transform
Dictionary-basedCount symbolic words in sliding windowsBOSS, WEASEL
Convolutional kernelsApply many random kernels, then a linear modelROCKET, MiniRocket
Deep learningLearn features end to endInceptionTime, ResNet, transformers
EnsemblesCombine several familiesHIVE-COTE 2
Method families and their characteristic ideas

The long-standing baseline is one-nearest-neighbor with dynamic time warping, which aligns sequences that are similar in shape but shifted or stretched in time. Its main drawback is quadratic cost per comparison, which becomes prohibitive for long series and large training sets.

Since about 2020, ROCKET and its successors have changed practice. They transform each series with thousands of random convolutional kernels and train a ridge classifier, reaching accuracy close to the best ensembles at a small fraction of the training time.

How it differs from forecasting and anomaly detection

Time series classification differs from neighboring tasks mainly in what the output describes. Forecasting predicts future values, anomaly detection flags unusual points or periods, and classification labels a complete sequence. The same sensor data can feed all three, but labels, loss functions and evaluation metrics differ.

TaskOutputTypical metric
Time series classificationOne label per sequenceAccuracy, F1, AUC
Time series forecastingFuture valuesMASE, sMAPE
Anomaly detectionScore per point or windowPrecision at recall
SegmentationChange points or labeled spansBoundary error
Time series regressionOne numeric value per sequenceRMSE, MAE
Classification compared with related time series tasks

A frequent source of confusion is windowed classification of streams. When a long recording is cut into windows and each window receives a label, the problem is still classification, but overlapping windows from the same recording must stay in the same data split to avoid leakage.

Choosing a method in practice

Choosing a method depends mostly on dataset size, series length and the need for interpretability. Practitioners usually start with a fast, strong baseline and move to heavier models only when the gain justifies the cost. Libraries such as sktime, aeon and tsai provide these methods behind a common interface.

SituationRecommended approachReason
Few hundred short series1-NN DTW or MiniRocketStrong accuracy with little data
Thousands of long seriesMiniRocket or MultiRocketLinear time and fast training
Need for explanationsShapelets or interval featuresPatterns map to visible segments
Very large labeled corpusInceptionTime or transformerDeep models scale with data
Maximum benchmark accuracyHIVE-COTE 2Ensembles are hard to beat
Decision guide for selecting a classifier

Limitations and common mistakes

The most damaging mistake is data leakage through the split. Windows from one patient, machine or session placed in both training and test sets inflate accuracy, sometimes by twenty points or more, because the model learns the individual rather than the class.

  • Class imbalance: rare failure classes need stratified splits and balanced metrics, not plain accuracy.
  • Normalization artifacts: per-series z-scoring removes absolute level, which is harmful when amplitude itself is informative.
  • Unequal lengths: padding with zeros can create false patterns; resampling or length-aware models are safer.
  • Benchmark overfitting: results on archive datasets do not always transfer to noisy industrial signals.

Finally, accuracy alone hides early classification needs. In monitoring, a correct label after the full sequence may arrive too late, so some systems use early classification methods that trade a little accuracy for a much faster decision.

In everyday language

Many devices record numbers over time. A smartwatch records your pulse. A factory sensor records vibration. Time series classification sorts each recording into a category.

Imagine listening to short clips of birdsong and naming the bird. You do not predict the next note. You recognize the whole tune by its rhythm and shape. A classifier does the same with numbers, learning from many labeled examples which shapes belong to which group.

Seen in the real world

A hospital cardiology team wants to screen single-lead electrocardiogram recordings from wearable patches for atrial fibrillation. Each recording lasts 30 seconds at 250 samples per second, giving 7,500 points per series, and cardiologists have labeled 20,000 recordings as normal rhythm, atrial fibrillation, other rhythm or too noisy.

The data scientists split the data by patient, not by recording, so no person appears in both training and test sets. A MiniRocket baseline trains in minutes and reaches a macro F1 score near 0.80, and a deeper InceptionTime model adds a few points after hours of GPU training.

The team deploys the faster model as a first-pass triage filter. Recordings it flags as atrial fibrillation go to a cardiologist for confirmation, which reduces the manual review workload while keeping a clinician responsible for every diagnosis.