> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EVALUATE_MODEL

Runs an inference against an [ML model](https://docs.kinetica.com/content/ml/concepts.md#ml-model).  There are two
methods to evaluate a model:

* *By Query* - An *ML model* can be queried, where the inference is returned as
  the result set.
* *By Execution* - An *ML model* can be run with the `EXECUTE FUNCTION`
  command, where the inference is persisted to a specified table.

```sql title="EVALUATE_MODEL Table Function Syntax" theme={null}
SELECT * FROM TABLE(
    EVALUATE_MODEL
    (
        MODEL => '<model name>',
        DEPLOYMENT_MODE => 'BATCH',
        REPLICATIONS => <number of replications>,
        SOURCE_TABLE => INPUT_TABLE(<source data set>)
    )
)
```

```sql title="EVALUATE_MODEL EXECUTE FUNCTION Syntax" theme={null}
EXECUTE FUNCTION EVALUATE_MODEL(
    MODEL => '<model name>',
    DEPLOYMENT_MODE => '<BATCH | CONTINUOUS>',
    REPLICATIONS => <number of replications>,
    SOURCE_TABLE => INPUT_TABLE(<source data set>),
    DESTINATION_TABLE => '<destination table name>'
)
```

## Parameters

> [accordion] MODEL
>
> Name of the *ML model* on which to run an inference

> [accordion] DEPLOYMENT\_MODE
>
> Scheme used in making inferences on the *ML model*:
>
> * `BATCH` - inference tests are run against a batch of data in an existing table all at once
> * `CONTINUOUS` - inference tests are run automatically against records being streamed into an
>   input table; inference results are inserted into an output table, which will be updated upon
>   each subsequent inference
>
>   > [!NOTE]
>   >
>   > Continuous deployment mode is only available when using the `EXECUTE FUNCTION`
>   > syntax, as it creates a destination table with the continuously updated results.

> [accordion] REPLICATIONS
>
> The number of replicas to launch on *Kubernetes*

> [accordion] SOURCE\_TABLE
>
> Table or query to use as input to the *ML model*, specified with either of these two forms:
>
> * `INPUT_TABLE(<table name>)` - Use the given table or view as input; e.g.:
>
>   ```
>   INPUT_TABLE(price_history)
>   ```
> * `INPUT_TABLE(<query>)` - Use the given query as input; e.g.:
>
>   ```
>   INPUT_TABLE(SELECT ts, item, price FROM price_history)
>   ```

> [accordion] DESTINATION\_TABLE
>
> Only applicable when using `EXECUTE FUNCTION` syntax. Name of the table in which to store the
> results of the inference, in `[schema_name.]table_name` format, using standard
> [name resolution rules](https://docs.kinetica.com/content/sql/naming.md#sql-name-resolution) and meeting
> [table naming criteria](https://docs.kinetica.com/content/sql/naming.md#sql-naming-criteria)

## Examples

```sql title="EVALUATE_MODEL Table Function Example" theme={null}
SELECT * FROM TABLE(
    EVALUATE_MODEL
    (
        MODEL => 'raster_model',
        DEPLOYMENT_MODE => 'batch',
        REPLICATIONS =>1,
        SOURCE_TABLE => INPUT_TABLE(select raster_uri from ki_home.raster_input)
    )
)
```

```sql title="EVALUATE_MODEL EXECUTE FUNCTION Example" theme={null}
EXECUTE FUNCTION EVALUATE_MODEL(
    MODEL => 'raster_model',
    DEPLOYMENT_MODE => 'batch',
    REPLICATIONS =>1,
    SOURCE_TABLE => INPUT_TABLE(select raster_uri from ki_home.raster_input),
    DESTINATION_TABLE => 'raster_output'
)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.