> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/sdgm/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/sdgm/_mcp/server.

# Commands and Operators

> Suggest Edits

## PREDICT and FOR EACH

A Predictive Query starts with a `PREDICT` clause that defines the value you want to predict. After specifying the prediction target in `PREDICT`, you must include a `FOR EACH` clause to specify the entity you want to make predictions for. Only a primary key column can be selected for this field.

## Boolean Operators

You can use any number of boolean operators in your predictive queries. For example, `LAST(LOAN.AMOUNT, 0, 30) = 2`.

## ASSUMING

`ASSUMING` allows you to investigate hypothetical scenarios and evaluate the impact of your actions or decisions. The `ASSUMING` keyword is followed by one or more future-looking temporal aggregations which will be assumed to be true during predictions.

For example, you may want to investigate how much a user will spend in the next 30 days if you give them more than two coupons or notifications in the next 7 days:

```Text PQL
PREDICT SUM(TRANSACTIONS.PRICE, 0, 30)
FOR EACH CUSTOMERS.CUSTOMER_ID
ASSUMING COUNT(NOTIFICATIONS.*, 0, 7) > 2
```

## CLASSIFY and RANK TOP K

When creating Predictive Queries with a `LIST_DISTINCT` aggregation target, you can use `CLASSIFY` and `RANK TOP K` to classify or retrieve only the top ranked values for a prediction, respectively.

### CLASSIFY

For example, the following predictive query predicts customer purchases over the next 30 days, resulting in a separate binary classification per article ID:

```Text PQL
PREDICT LIST_DISTINCT(TRANSACTIONS.ARTICLE_ID, 0, 30) CLASSIFY
FOR EACH CUSTOMERS.CUSTOMER_ID
```

If you don't specify a `TOP K` clause, we will generate classes for all available classes up to the limit.

### RANK

In contrast, the following predictive query uses `RANK TOP K` at the end of the target definition (where K is the number of items of interest) to predict likely customer purchases—in this case ranking the top 12 products the customer is most likely to buy in the next 30 days:

```Text PQL
PREDICT LIST_DISTINCT(TRANSACTIONS.ARTICLE_ID, 0, 30) RANK TOP 12
FOR EACH CUSTOMERS.CUSTOMER_ID
```

Using `RANK` on a foreign key is the only scenario where Kumo will allow adding new targets at batch prediction time—in this case, by adding new rows to the article table.

***

What’s Next

* [Putting It All Together](/putting-it-all-together)

* [Table of Contents](#)

* * [PREDICT and FOR EACH](#predict-and-for-each)

  * [Boolean Operators](#boolean-operators)

  * [ASSUMING](#assuming)

  * [CLASSIFY and RANK TOP K](#classify-and-rank-top-k)

    * [CLASSIFY](#classify)
    * [RANK](#rank)