Of course. Here is a detailed explanation of the ROCKET algorithm for time series classification.
1. Introduction: What is ROCKET?
ROCKET (RandOm Convolutional Kernel Transform) is a highly efficient and accurate algorithm for Time Series Classification (TSC). It was introduced in 2019 by Dempster, Petitjean, and Webb and fundamentally changed the landscape of TSC research.
The core idea of ROCKET is surprisingly simple: instead of learning complex features from time series data using deep neural networks (which is slow and computationally expensive), ROCKET demonstrates that you can achieve state-of-the-art accuracy by transforming the time series using a large, diverse set of random convolutional kernels and then using the output of this transformation to train a simple, fast linear classifier.
In essence, ROCKET is a feature extractor, not an end-to-end learning model. Its job is to turn a variable-length time series into a fixed-length feature vector.
2. The Problem ROCKET Solves
Before ROCKET, the top-performing TSC algorithms were generally one of two types:
- Distance-Based Methods: Like Dynamic Time Warping (DTW), which are accurate but very slow, especially on large datasets, because they require pairwise comparisons between all time series.
- Deep Learning Models: Like InceptionTime, which are also highly accurate but require significant training time, large amounts of data, and specialized hardware (GPUs).
There was a clear trade-off between speed and accuracy. ROCKET broke this trade-off by offering the accuracy of deep learning models with a training speed that is orders of magnitude faster.
3. The Core Idea: The Power of Randomness
The "Aha!" moment behind ROCKET is the discovery that you don't need to learn the convolutional kernels through a complex process like backpropagation. Instead, by generating thousands of random kernels with different properties (length, weights, dilation, etc.), you are almost guaranteed to create a set of kernels that can collectively capture a vast and rich variety of patterns within the time series data.
Some kernels might be good at detecting sharp peaks, others might detect slow-moving trends, and others might find specific oscillatory patterns. While any single random kernel is likely useless, the combined information from thousands of them is incredibly powerful.
4. How ROCKET Works: A Step-by-Step Breakdown
The ROCKET algorithm consists of two main phases: Feature Transformation and Classification.
Phase 1: Feature Transformation (The ROCKET Transform)
This is the core of the algorithm. For each individual time series in your dataset, you perform the following steps:
Step 1: Generate a Large Set of Random Kernels
The algorithm generates a predefined number of kernels (the default is 10,000). Each kernel is defined by five randomly chosen parameters:
- Length (or Size): The length of the kernel is chosen randomly from a set of predefined values (e.g., 7, 9, 11). This allows kernels to capture patterns of different durations.
- Weights: The values inside the kernel are drawn from a standard normal distribution (mean=0, std=1). A key constraint is applied: the sum of the weights is made to be zero by subtracting the mean from all weights. This makes the kernel a "shapelet" detector rather than a simple averager.
- Bias: A single bias term is drawn uniformly from a random range (e.g., [-1, 1]). This bias is added to the result of the convolution at each step, shifting the output up or down.
- Dilation: A random dilation factor is chosen. Dilation allows the kernel to have a larger "receptive field" without increasing its actual size. For example, a kernel of length 3 with a dilation of 2 will look at points
t, t+2, and t+4. This helps capture patterns at different scales and frequencies.
- Padding: Padding is randomly applied (or not). When the kernel is applied near the edges of the time series, padding ensures the output feature map has the same length as the input time series.
[image: ROCKET Kernels] open
Step 2: Apply Kernels via Convolution
Each of the 10,000 random kernels is convolved with the input time series. A 1D convolution slides the kernel across the time series, computing the dot product at each position. The bias is then added. This process produces a new time series called a feature map. Each feature map highlights where the specific pattern represented by its kernel was found in the original time series.
Step 3: Extract Summary Features from Each Feature Map
A full feature map is too much information to use directly. ROCKET summarizes each one by extracting two simple scalar values (features):
- Max (Maximum Value): This is simply the global maximum value of the feature map. It represents the strongest presence of the kernel's specific pattern anywhere in the time series. This is equivalent to global max-pooling.
- PPV (Proportion of Positive Values): This is the count of all values in the feature map that are greater than zero, divided by the total length of the feature map. This feature captures the prevalence or frequency of the pattern.
Step 4: Concatenate Features
For each of the 10,000 kernels, we get two features (max and PPV). These are all concatenated into a single, long feature vector.
- Final Feature Vector = [max_k1, ppv_k1, max_k2, ppv_k2, ..., max_k10000, ppv_k10000]
So, for the default setting of 10,000 kernels, every time series in the dataset is transformed into a 20,000-dimensional feature vector. Crucially, every time series is now represented by a vector of the same length, regardless of its original length.
Phase 2: Train a Linear Classifier
Now that the entire dataset has been transformed into a standard tabular format (a matrix of feature vectors and a vector of labels), the final step is incredibly simple and fast.
You train a simple, efficient linear model on these features. The authors found that a Ridge Regression Classifier works exceptionally well, but other linear models like Logistic Regression are also effective. These models are very fast to train, even on high-dimensional data, because they don't involve complex iterative processes like deep learning.
5. Strengths and Weaknesses
Strengths:
- Extreme Speed: The transformation step is highly parallelizable, and training a linear classifier is computationally cheap. This makes ROCKET orders of magnitude faster to train than deep learning models.
- State-of-the-Art Accuracy: Despite its simplicity, ROCKET is highly competitive with, and often matches or exceeds, the accuracy of the most complex deep learning architectures on most TSC benchmarks.
- Simplicity: The underlying concepts are much easier to understand and implement than deep neural networks.
- Scalability: It scales well to datasets with a very large number of time series.
Weaknesses:
- High-Dimensional Features: The resulting 20,000-dimensional feature vector can be memory-intensive.
- Lack of Interpretability: Because the kernels are random, it's very difficult to inspect the model and understand exactly which specific time series patterns were most important for classification.
- Not End-to-End: It requires two separate stages (transformation and classification), which can be less elegant than an end-to-end model.
6. The Evolution: MINIROCKET and MULTIROCKET
The original ROCKET has since been improved upon by its creators:
-
MINIROCKET (2021): This version addresses the speed and memory issues of ROCKET. Instead of fully random kernels, MINIROCKET uses a fixed, curated set of 84 specific kernel patterns (e.g., patterns with only two non-zero values). It only randomizes dilation. It also replaces the max feature with only PPV, which can be calculated much more efficiently. The result is a model that is up to 75 times faster than the original ROCKET with virtually no loss in accuracy. It is also deterministic, meaning it gives the same result every time you run it.
-
MULTIROCKET (2021): This version focuses on boosting accuracy even further. It expands the feature set by applying the ROCKET transformation not only to the raw time series but also to its first-order difference (the change between consecutive time steps). This allows it to capture patterns in both the value and the trend of the series, leading to a new state-of-the-art in accuracy on many benchmarks.
Conclusion
ROCKET is a landmark algorithm in time series analysis. It provides a powerful lesson: an ensemble of a massive number of diverse, random, and simple features can be just as effective as a small number of complex, learned features. By trading the slow process of learning for the clever application of randomness, ROCKET delivered top-tier accuracy at a fraction of the computational cost, making high-performance time series classification accessible to a much wider range of users and applications.