A temporal model is a query pipeline
Execution sketchAlign, learn, predict
timestampedInputs
WITHINAlign
windowedFeatures
online / LLMModel
predictionCompute
- 01Timestamp inputs
Every participating stream declares its event-time field.
- 02Align streams
Optional `ALIGN JOIN` clauses match nearby records within a bounded tolerance.
- 03Partition and window
Keys and temporal context isolate model state.
- 04Build features
Field, difference, average, count, standard deviation, and z-score features are declared explicitly.
- 05Define supervision
Classifiers use `LABELS`; regressors use `TARGET`; `FUTURE` creates bounded forward labels.
- 06Compute results
Project classifications, probabilities, confidence, predictions, residuals, or extracted values.
Online classifier and regressor
Online classifier with aligned inputChronusQL
SELECT c.device_id, predicted_label, confidence
INTO output
FROM cpu AS c TIMESTAMP BY c.ts
ALIGN JOIN memory AS m TIMESTAMP BY m.ts
ON c.device_id = m.device_id
WITHIN Duration(second, 5)
ANCHOR c
PARTITION BY c.device_id
WINDOW BY SlidingWindow(Duration(minute, 30))
FEATURES
cpu_value = c.cpu,
memory_value = m.memory
LABELS
impact = FUTURE(c.latency > 500, Duration(second, 10)),
normal = c.cpu < 60 AND m.memory < 70
MODEL incident = TRAIN ONLINE_CLASSIFIER()
LABELS impact, normal
WITH (min_examples = 20)
COMPUTE
predicted_label = CLASSIFY(incident),
confidence = PROBABILITY(incident)Online regressorChronusQL
SELECT p.device_id, prediction, residual
INTO output
FROM readings AS p TIMESTAMP BY p.ts
PARTITION BY p.device_id
WINDOW BY SlidingWindow(Duration(minute, 30))
FEATURES
current_value = p.value,
value_delta = DIFF(p.value),
window_mean = AVG(p.value)
MODEL forecast = TRAIN ONLINE_REGRESSOR()
TARGET p.next_value
WITH (min_examples = 4)
COMPUTE
prediction = PREDICT(forecast),
residual = RESIDUAL(forecast)Feature and output functions
| Context | Functions |
|---|---|
| Features | Field expression, DIFF, AVG, MEAN, COUNT, STDDEV, ZSCORE |
| Labels | Boolean condition or FUTURE(condition, Duration(...)) |
| Classifier output | CLASSIFY, PROBABILITY, CONFIDENCE |
| Regressor output | PREDICT, RESIDUAL |
| LLM output | CLASSIFY, CONFIDENCE, or EXTRACT according to task |
Bounded LLM classification and extraction
Classify a text featureChronusQL
SELECT category, confidence
INTO output
FROM logs AS l TIMESTAMP BY l.ts
FEATURES text = l.message
MODEL classifier = LLM(
TASK 'classify',
INPUT text,
LABELS ('normal', 'alert'),
PROVIDER 'default'
)
COMPUTE
category = CLASSIFY(classifier),
confidence = CONFIDENCE(classifier)Extract a structured valueChronusQL
SELECT extracted
INTO output
FROM logs AS l TIMESTAMP BY l.ts
FEATURES text = l.message
MODEL extraction = LLM(
TASK 'extract',
INPUT text,
SCHEMA '{"value":"string"}',
PROVIDER 'default'
)
COMPUTE extracted = EXTRACT(extraction)