WHERE Clause (Context Filters)
TheWHERE clause controls which historical rows are used as context examples for the prediction. These filters are not applied to the entity list itself — they only affect the context data that KumoRFM uses to generate features.
Temporal Filters
Filter context examples based on temporal aggregations. This is useful for focusing predictions on specific subsets of historical behavior.-30, 0) looks at the past 30 days relative to “now”, providing a temporal filter on the context.
Static Filters
Filter context examples based on static column values.Static column-value filtering (e.g.,
WHERE users.age > 21) is currently only supported for columns within the same table as the target or entity.IN Clause (Entity Specification)
TheIN clause specifies which entities to make predictions for. You can specify a single entity or a list of entities.
Single entity:
indices parameter:
indices is provided, it overrides the entity specification in the query string. For large entity lists, use KumoRFM.batch_mode().
Logical Operators
Combine multiple conditions usingAND, OR, and NOT operators.
AND
Require all conditions to be true.OR
Require any one condition to be true. When used in thePREDICT clause, both operands must return the same type (e.g., both boolean for binary classification).
NOT
Negate a condition.Combined Example
Anchor Time
The anchor time defines “now” — the reference point in time from which the prediction horizon is measured. By default, KumoRFM uses the maximum timestamp found in the data. You can customize the anchor time via theanchor_time parameter in KumoRFM.predict() and KumoRFM.evaluate():
Default (auto-detect):
anchor_time="entity" when each entity has its own meaningful reference point in time, rather than a single shared “now”. KumoRFM will use each entity’s own time column value as its anchor.
anchor_time="entity", KumoRFM uses the timestamp stored in the entity’s time column as “now” for that entity.
context_anchor_time.
anchor_time to June 1 tells KumoRFM “predict from this future date”, while context_anchor_time set to March 1 tells it “build your context from data as it existed on March 1”. This is useful for forward-looking batch scoring where you want predictions for a future date using only data available today.
ASSUMING Clause
TheASSUMING clause lets you condition a prediction on a hypothetical state — asking “what would happen if this entity had a specific attribute value?”
ASSUMING to answer counterfactual questions — for example, “would this customer churn if we upgraded them to premium?” or “how would revenue change if this item were marked as featured?”
Unsupported Features
The following PQL features are not yet supported in KumoRFM:- Only numerical and categorical columns are valid target columns.
- Filtering by column value is only supported for columns within the same table.