Prediction Results
client.relational(graph).predict() returns Kumo Relational results as a pandas DataFrame. The ENTITY field maps each result row to an input entity. Temporal predictions can also include ANCHOR_TIMESTAMP. Join downstream data by using these identifier fields instead of relying on row position.
Result fields
The fields that are present depend on the prediction task and the requested outputs.
Do not assume that every task returns every field or one row per input entity. Binary classification and regression return one row per entity. Multiclass classification returns one row per entity per class, temporal link prediction returns one row per candidate, and forecasting returns one row per forecast timeframe. Inspect the DataFrame columns or the NIM model capabilities before processing optional outputs.
The Python SDK DataFrame uses uppercase PREDICTION. The NIM REST response uses lowercase prediction in each prediction item. Refer to NIM REST API when working with the wire format directly.
Illustrative shapes
Scalar regression:
Boolean classification:
Multiclass classification:
Filter the winning row for each entity with result[result["PREDICTED"]]. Do not coerce CLASS to a string; it preserves the target column’s dtype.
Forecasting:
A forecasting result contains one row per entity per forecast step. FORECAST_STEP is one-based.
Temporal link prediction with three ranked candidates:
A RANK TOP 3 link-prediction query returns three rows per entity, ordered from the highest-scoring candidate to the lowest.
These examples show only the column structure. The values depend on the query and the deployed release.
Classification probabilities
Binary-classification probabilities are expanded into separate columns, such as TRUE_PROB and FALSE_PROB. Multiclass classification instead returns one row per class with CLASS, SCORE, and PREDICTED.
Ranked results
The SDK expands ranked outputs to one row per candidate. CLASS contains the candidate identifier and SCORE contains its ranking score. Preserve the returned row order when presenting candidates for the same entity.
Quantiles and forecasts
Quantile outputs use columns prefixed with Q_. The exact quantile levels depend on the requested inference output. A forecast returns one row per timeframe and uses FORECAST_STEP to identify the one-based sequence.
Explanations
When explain=True, predict() returns an Explanation object instead of a bare DataFrame. Its prediction attribute contains the prediction DataFrame, details contains structured attribution, and summary contains natural-language text when the backend provides it. See Prediction Explainability.