Configuration
Configure predictions by passing settings directly to PredictiveQuery.materialize(...) and to client.predict(...). The following sections describe the available settings, their defaults, and how to use them.
There is no run_mode in sdm-client. Set num_context_samples directly on materialize() — the client derives what the endpoint needs from that number instead of a preset.
Neighborhood sampling
Kumo Relational samples a relational neighborhood around each prediction entity. By default, it samples two hops.
num_neighbors controls both the number of hops and the maximum neighbor fan-out at each hop:
- The number of entries determines the number of hops.
- Each entry specifies the maximum number of neighbors sampled at that hop. For example,
num_neighbors=[16, 8, 4]requests three hops, with fan-outs of 16, 8, and 4. - Kumo Relational supports at most six hops.
num_hops accepts values from 1 through 6. When you provide num_neighbors, its length determines the sampling depth and takes precedence over num_hops.
Larger fan-outs and deeper neighborhoods can substantially increase sampling time, memory use, and request size.
Context size
num_context_samples sets the number of labeled context rows to gather. Omit it on a relational request and you get the smaller budget, up to 1,000 examples. Ask for more, up to 10,000, and the client uses the wider budget the endpoint offers.
The number is honored, not rounded up to a bucket. Ask for more than exists and you get what exists; ask for more than 10,000 and you’re told the ceiling.
When narrowing applies to a temporal question, it keeps the newest anchors, not a random sample across time. The engine gathers a block of entities per anchor date, newest first, and a narrowed count slices from the front: the result is full coverage of the most recent anchors and no coverage of older ones, not a thinned sample across the whole span. Entities within one anchor block are sampled, and that part does follow random_seed.
Materialize options
The following are keyword arguments to PredictiveQuery.materialize(...).
Unknown materialize options are rejected during materialization, naming the accepted set.
Inference configuration
Pass inference_config as a dictionary. These fields are forwarded to the deployment, and acceptance is deployment dependent — a deployment may reject any value that differs from its own configured default, so check what a deployment accepts before setting any of them. The relational engine defaults to num_estimators=1.
Accepted fields
Some deployments accept only their own configured num_estimators value and reject every shuffle flag. Check a deployment’s accepted values before setting these, or omit inference_config to use the deployment’s defaults.
Some deployments also do not accept target_transforms or output_type in inference_config, even though earlier clients exposed them for regression and forecasting quantile control. Ask for outputs=[..., "quantiles"] on client.predict() instead to receive quantile predictions as quantile_<level> columns — there is no client-side control over which quantile levels come back.
Output controls
Limits
The endpoint enforces several size limits. materialize() checks them before sending and refuses or samples while naming the limit.
A request for more entities than one call scores is not refused: materialize() gathers it in batches of at most that many, predict() sends one call per batch, and the results come back as one PredictionResult. A ranking or a forecast is a different kind of “several calls” — one per candidate or step — and is bounded separately by MOST_PARTS (200); it cannot additionally be batched, so a ranking over 200 candidates and 50,000 entities is refused rather than silently sent as 200 × 50 calls.
Pass rows_per_call to ask in smaller batches than the default; it only ever goes down. Reach for it when a graph is wide enough that a full batch outruns the 30 MiB body, or your deployment’s cap is lower than this client’s default.
A call that fails ends the request, but the answers already paid for are not discarded: they’re carried on the error as details['answered'] and details['rows_answered'] (or details['parts_answered'] for a forecast), so you can ask again for only the rest.
Choose settings conservatively
Start with the defaults. Change one dimension at a time and measure the effect on latency, request size, and prediction quality with representative data.
If a request becomes too large, first reduce num_neighbors or num_context_samples, then rows_per_call. You can also remove unused columns or tables. See Batch Prediction for scoring jobs beyond what one materialize() call handles.