Make Predictions
Once you have created your graph, the next step is to frame a predictive problem — defining what you want to predict, who to predict for, and under what context.
Kumo provides a simple, declarative way to do this using the Predictive Query Language (PQL).
If you are familiar with Predictive query, scroll down to section “5. Run & fetch results” to get the code to make prediction on your graph
What is PQL?
Predictive Query Language (PQL) is a declarative, SQL-like syntax that lets you describe an entire machine learning task in a single statement.
A predictive query defines:
- The target value to predict,
- The entity or set of entities to make predictions for,
- And optionally, filters that refine the feature context.
Once defined, RFM automatically handles feature computation, time alignment, and train table generation - all based on your underlying graph.
Anatomy of a Predictive Query
At its core, a predictive query follows this structure:
Writing Queries in Kumo
To write a predictive query in Kumo, follow these five steps:
1. Choose your entity
Select the table and primary key column that represent the entity you’ll predict for.
Example:
This tells RFM to make predictions for each customer_id
2. Define the target
The target defines what outcome or value the model should predict.
It can be:
- A raw column, e.g.,
PREDICT customer_churn_flag - Or an aggregation over a future horizon, e.g.:
This tells RFM to predict total transaction amount over the next 30 days for each customer.
3. Pin the entity list
You can specify one entity or a group of entities explicitly:
OR
This ensures RFM generates predictions only for the entities you care about.
4. (Optional) Refine the context
Use the WHERE clause to control the feature generation window or apply static filters.
For example:
This does not change the entities you’re predicting for - it simply limits which historical data RFM uses when building features.
5. Run & fetch results
Execute your predictive query using the RFM client:
To see more examples on predictive query refer to predictive query reference