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

Teradata Vantage™ - Bring Your Own Model User Guide

Product
Teradata Vantage
Release Number
3.0
Published
May 2022
Last Update
2022-06-02
Content Type
User Guide
Publication ID
B700-1111-051K
Language
English (United States)

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}