ONNXPredict Example with ModelOutputFields | Vantage BYOM - ONNXPredict Example: With ModelOutputFields - Teradata Vantage

Teradata Vantage™ - Bring Your Own Model User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
Lake
VMware
Product
Teradata Vantage
Release Number
5.0
Published
October 2023
Language
English (United States)
Last Update
2024-04-06
dita:mapPath
fee1607120608274.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
fee1607120608274

Use the ModelOutputFields argument to create an output column based on a specific output from the model instead of getting all of the output fields in one generic column json report.

select * from mldb.ONNXPredict(
    on (select  * sample 10 from iris_test )
    on (select * from onnx_models where model_id='sklearn_rf_iris_model') DIMENSION
    using
        Accumulate('sepal_length')
        modelOutputFields('output_probability')
        OverWriteCachedModel('sklearn_rf_iris_model')    // same effect as using ‘*’ or ‘true’ – In this example, a new version of the model is replacing the current version in the cache.
) as td
;

 *** Query completed. 10 rows found. 2 columns returned.
 *** Total elapsed time was 1 second.
	sepal_length 	output_probability
-------------------- -------------------------------------------------------
 5.60000000000000E 000                 {"0":0.0,"1":0.99999934,"2":0.0}
 6.70000000000000E 000                 {"0":0.0,"1":0.0,"2":0.99999934}
 5.00000000000000E 000                 {"0":0.99999934,"1":0.0,"2":0.0}
 5.10000000000000E 000                 {"0":0.99999934,"1":0.0,"2":0.0}
 6.90000000000000E 000                 {"0":0.0,"1":0.0,"2":0.99999934}
 5.10000000000000E 000                 {"0":0.99999934,"1":0.0,"2":0.0}
 6.50000000000000E 000                 {"0":0.0,"1":0.98999935,"2":0.01}
 6.70000000000000E 000                 {"0":0.0,"1":0.0,"2":0.99999934}
 6.10000000000000E 000                 {"0":0.0,"1":0.12999998,"2":0.86999947}
 4.90000000000000E 000                 {"0":0.99999934,"1":0.0,"2":0.0}