Predict a Yes or No Outcome on Linux
Predict whether each active AdventureWorks customer will order in the next 90 days, then convert the model’s probabilities into yes or no predictions. This example runs a binary classification fit and writes predictions at three probability thresholds. Evaluate the model and choose a threshold that matches your business objective before using its decisions. This guide uses Kumo Engine’s local Python API from the Linux setup.
Prerequisites
Before you start, complete the following prerequisites:
- Complete the steps in Install Kumo Engine on Linux.
- Download the Linux examples bundle and prepare the sample CSV files. Use the four prepared AdventureWorks CSVs.
- Activate the installed Python environment and keep
ADVENTUREWORKS_DATAset to the prepared CSV directory.
Run the Complete Example
To run the complete example, run the bundled script from the extracted bundle directory with the following command. Replace the two output paths with new, separate directories. Use local storage for scratch and retain results on storage whose lifetime meets your needs. Keep both directories separate from the inputs and from each other.
The script builds the graph, generates historical labels from the event data, suggests a model plan, trains the model, and writes the model and prediction outputs.
Review the model plan and training budget before adapting it to production data.
It saves the model under model/ and writes one prediction file for each threshold: 0.0, 0.5, and 1.0.
It trains the model a single time.
A nonzero exit means the example did not complete. Preserve its error and existing outputs, correct the reported problem, and choose a new output directory before another attempt.
Understand the Prediction Task
The script uses this predictive query:
At each training time, the label asks whether the customer has at least one order after that time and up to and including 90 days later.
The > 0 comparison turns a numeric event count into a binary target.
It is separate from the probability threshold used after the model predicts.
Generated training rows use ENTITY1, TIMESTAMP, and TARGET1.
The WHERE clause limits the population to customers with an order in the preceding 365 days.
Set the Prediction Time and Threshold
The example predicts from June 30, 2025. Pass a datetime without timezone information. Kumo interprets it as UTC. Set the time when generating the prediction table. Pass that table and the matching snapshot to inference.
When adapting the script in your own Python process, use the following call pattern.
It requires the binary query, its training snapshot, the fitted trainer, and KUMO_BINARY_OUTPUT from the example.
The output configuration writes a separate binary-custom.parquet file and replaces that file if you repeat the call.
Refer to Train a Classification Model. The bundled script contains the complete binary setup.
These objects do not remain available after the script exits.
Supply a finite numeric threshold from 0 to 1, inclusive. The API does not select 0.5 for you.
If the call reports that binary_classification_threshold must be specified, add this argument.
An out-of-range or nonfinite value raises a ValueError. Replace it with a finite number in the permitted range.
A row is predicted true only when True_PROB is strictly greater than the supplied threshold.
A probability equal to the threshold is predicted false.
Changing the threshold changes this decision rule. It does not retrain the model.
Do not assume that separate inference calls produce numerically identical probabilities.
Inspect the Saved Predictions
To inspect the saved predictions, wait for the script to exit, then read its middle-threshold output in a new Python process with the same KUMO_BINARY_OUTPUT environment variable:
Expect one row per eligible customer, with these columns:
The other two files are predictions-threshold-0.0.parquet and predictions-threshold-1.0.parquet.
Each applies its own threshold to the same type of output.
Use an appropriate evaluation dataset and training budget before choosing a production threshold.
Next Steps
For more information, refer to the following topics: