ROCKET random convolutional kernel features for time-series classification
Installing and Loading
INSTALL rocket FROM community;
LOAD rocket;
Example
-- 250 kernels produce 500 features: element 2i is kernel i's global max,
-- 2i+1 its proportion of positive values.
SELECT rocket_transform(values, 250, 0, 0) AS features FROM series;
-- Kernel i is a pure function of (seed, i), so a group of kernels is addressable
-- without generating the groups before it. These are the same kernels:
SELECT rocket_transform(s, 4, 7, 4) = rocket_transform(s, 8, 7, 0)[9:16];
-- true
-- Multivariate: outer list channels, inner list timepoints. Still 2 features
-- per kernel -- the selected channels are summed inside one convolution.
SELECT rocket_transform(channels, 250, 0, 0) FROM multivariate_series;
-- Variable-length: pass an explicit reference length so every row shares one
-- kernel bank. Without it each row draws its own, and column j stops meaning
-- the same thing across rows.
SELECT rocket_transform(values, 250, 0, 0, 64) FROM ragged_series;
About rocket
rocket_transform implements ROCKET (Dempster, Petitjean & Webb, 2020): it convolves a
series with random kernels of random length, dilation, padding and bias, and reduces each
kernel's response to two features — the global maximum and the proportion of positive
values. No training is involved, so there is no model to fit or store.
rocket_transform(series DOUBLE[], kernels_per_group BIGINT, seed BIGINT, first_kernel BIGINT)
-> DOUBLE[]
Features are interleaved: element 2i is kernel i's max and 2i+1 its PPV.
first_kernel selects a contiguous slice of one conceptual kernel bank. Kernel i is a
pure function of (seed, i) — derived through SplitMix64 used as a splittable seed source —
so group g can be generated without generating groups 0..g-1, and kernels can be fanned
across threads with no shared generator state. This is what makes it practical to split a
10,000-kernel bank into groups narrow enough for a downstream classifier's per-estimator
feature budget.
Multivariate series go in as DOUBLE[][] (channels of timepoints). Each kernel draws a
random subset of channels with independent weights per channel and still produces exactly
two features, because the selected channels are summed inside a single convolution. A
one-channel series produces byte-identical kernels through either overload.
For variable-length data, pass an explicit reference length as a fifth argument. Kernel weights do not depend on series length but dilation and padding do, so without it each row draws its own kernel bank and the columns stop being comparable across rows. Note also that the max feature is biased upward by series length while PPV is not — if length correlates with the label, half the features carry that correlation.
The pseudo-random stream is specified byte-for-byte in the project's SPEC.md, and the extension is validated against golden vectors emitted by an independent Python implementation: maximum absolute difference 1.8e-15, with PPV differences of exactly zero.
The intended use is composition with a tabular foundation model — for example
anofox_tabfm's tabfm_classify — to classify time series without training anything:
features go in as columns, class probabilities come back, and probabilities are averaged
across kernel groups.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| rocket_transform | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.