You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generates a predicted value or scores based on a stored model. For more information, see [Native scoring using the PREDICT T-SQL function](../../machine-learning/predictions/native-scoring-predict-transact-sql.md).
The `MODEL` parameter is used to specify the model used for scoring or prediction. The model is specified as a variable or a literal or a scalar expression.
159
137
160
138
`PREDICT` supports models trained using the [RevoScaleR](../../machine-learning/r/ref-r-revoscaler.md) and [revoscalepy](../../machine-learning/python/ref-py-revoscalepy.md) packages.
@@ -163,29 +141,25 @@ The `MODEL` parameter is used to specify the model used for scoring or predictio
163
141
::: moniker range="=azuresqldb-mi-current"
164
142
The `MODEL` parameter is used to specify the model used for scoring or prediction. The model is specified as a variable or a literal or a scalar expression.
165
143
166
-
In Azure SQL Managed Instance, `PREDICT` supports models in [Open Neural Network Exchange (ONNX)](https://onnx.ai/get-started.html) format or models trained using the [RevoScaleR](../../machine-learning/r/ref-r-revoscaler.md) and [revoscalepy](../../machine-learning/python/ref-py-revoscalepy.md) packages.
167
-
168
-
> [!IMPORTANT]
169
-
> Support for ONNX in `PREDICT` is in preview in Azure SQL Managed Instance.
144
+
In Azure SQL Managed Instance, `PREDICT` supports models trained using the [RevoScaleR](../../machine-learning/r/ref-r-revoscaler.md) and [revoscalepy](../../machine-learning/python/ref-py-revoscalepy.md) packages.
170
145
171
146
::: moniker-end
172
147
173
148
::: moniker range=">=azure-sqldw-latest"
174
149
The `MODEL` parameter is used to specify the model used for scoring or prediction. The model is specified as a variable or a literal or a scalar expression or a scalar subquery.
175
150
176
-
In Azure Synapse Analytics, `PREDICT` supports models in [Open Neural Network Exchange (ONNX)](https://onnx.ai/get-started.html) format.
151
+
In Azure Synapse Analytics, `PREDICT` supports models in [Open Neural Network Exchange (ONNX)](https://onnx.ai/get-started.html) format. For more information, see [ONNX](/azure/machine-learning/concept-onnx#get-onnx-models).
177
152
::: moniker-end
178
153
179
154
**DATA**
180
155
181
156
The DATA parameter is used to specify the data used for scoring or prediction. Data is specified in the form of a table source in the query. Table source can be a table, table alias, CTE alias, view, or table-valued function.
182
157
158
+
::: moniker range=">=azure-sqldw-latest"
183
159
**RUNTIME = ONNX**
184
160
185
-
> [!IMPORTANT]
186
-
> The `RUNTIME = ONNX` argument is only available in [Azure SQL Edge](/azure/sql-database-edge/onnx-overview), [Azure Synapse Analytics](/azure/synapse-analytics/overview-what-is), and is in preview in [Azure SQL Managed Instance](/azure/azure-sql/managed-instance/machine-learning-services-overview).
187
-
188
-
Indicates the machine learning engine used for model execution. The `RUNTIME` parameter value is always `ONNX`. The parameter is required for Azure SQL Edge and Azure Synapse Analytics. On Azure SQL Managed Instance (in Preview), the parameter is optional and only used when using ONNX models.
161
+
Indicates the machine learning engine used for model execution. The `RUNTIME` parameter value is always `ONNX`. The `RUNTIME` parameter is required for Azure Synapse Analytics. The `RUNTIME = ONNX` argument is only available in Azure Synapse Analytics.
162
+
::: moniker-end
189
163
190
164
**WITH ( <result_set_definition> )**
191
165
@@ -210,7 +184,7 @@ The `PREDICT` function is supported in all editions of SQL Server 2017 or later,
The model that you use must have been created using one of the supported algorithms from the [RevoScaleR](../../machine-learning/r/ref-r-revoscaler.md) or [revoscalepy](../../machine-learning/python/ref-py-revoscalepy.md) packages. For a list of currently supported models, see [Native scoring using the PREDICT T-SQL function](../../machine-learning/predictions/native-scoring-predict-transact-sql.md).
215
189
::: moniker-end
216
190
::: moniker range="=azure-sqldw-latest"
@@ -232,7 +206,7 @@ The following examples demonstrate the syntax for calling `PREDICT`.
232
206
233
207
This example references the `PREDICT` function in the `FROM` clause of a `SELECT` statement:
@@ -256,10 +230,10 @@ FROM PREDICT(MODEL = @model,
256
230
257
231
The alias **d** specified for table source in the `DATA` parameter is used to reference the columns belonging to `dbo.mytable`. The alias **p** specified for the `PREDICT` function is used to reference the columns returned by the `PREDICT` function.
258
232
259
-
- The model is stored as `varbinary(max)` column in table called `Models`. Additional information such as `ID` and `description` is saved in the table to identify the model.
233
+
- The model is stored as **varbinary(max)** column in table called `Models`. Additional information such as `ID` and `description` is saved in the table to identify the model.
260
234
- The alias **d** specified for table source in the `DATA` parameter is used to reference the columns belonging to `dbo.mytable`. The input data column names should match the name of inputs for the model.
261
235
- The alias **p** specified for the `PREDICT` function is used to reference the predicted column returned by the `PREDICT` function. The column name should have the same name as the output name for the model.
262
-
- All input data columns and the predicted columns are available to display in the SELECT statement.
236
+
- All input data columns and the predicted columns are available to display in the `SELECT` statement.
263
237
264
238
::: moniker range=">=azure-sqldw-latest"
265
239
@@ -279,7 +253,7 @@ FROM PREDICT(MODEL = (SELECT test_model FROM scoring_model WHERE model_id = 1),
279
253
280
254
A common use case for prediction is to generate a score for input data, and then insert the predicted values into a table. The following example assumes the calling application uses a stored procedure to insert a row containing the predicted value into a table:
DECLARE @model VARBINARY(max) = (SELECT model FROM scoring_model WHERE model_name ='ScoringModelV1');
@@ -304,18 +278,17 @@ FROM PREDICT(MODEL = @model, DATA = dbo.mytable AS d, RUNTIME = ONNX) WITH(score
304
278
:::moniker-end
305
279
306
280
- The results of `PREDICT` are stored in a table called `PredictionResults`.
307
-
- The model is stored as `varbinary(max)` column in table called `Models`. Additional information such as ID and description can be saved in the table to identify the model.
308
-
- The alias **d** specified for table source in the `DATA` parameter is used to reference the columns in `dbo.mytable`. The input data column names should match the name of inputs for the model.
309
-
- The alias **p** specified for the `PREDICT` function is used to reference the predicted column returned by the `PREDICT` function. The column name should have the same name as the output name for the model.
310
-
- All input columns and the predicted column are available to display in the SELECT statement.
281
+
- The model is stored as **varbinary(max)** column in table called `Models`. Additional information such as ID and description can be saved in the table to identify the model.
282
+
- The alias `d` specified for table source in the `DATA` parameter is used to reference the columns in `dbo.mytable`. The input data column names should match the name of inputs for the model.
283
+
- The alias `p` specified for the `PREDICT` function is used to reference the predicted column returned by the `PREDICT` function. The column name should have the same name as the output name for the model.
284
+
- All input columns and the predicted column are available to display in the `SELECT` statement.
311
285
312
-
## Next steps
286
+
## Related content
313
287
314
288
Learn more about related concepts in the following articles:
315
289
316
290
-[Native scoring using the PREDICT T-SQL function](../../machine-learning/predictions/native-scoring-predict-transact-sql.md)
317
291
-[RevoScaleR (R package in SQL Server Machine Learning Services)](../../machine-learning/r/ref-r-revoscaler.md)
318
292
-[Revoscalepy (Python package in SQL Server Machine Learning Services)](../../machine-learning/python/ref-py-revoscalepy.md)
0 commit comments