ONNXPredict Example with ModelInputFieldsMap | Vantage BYOM - ONNXPredict Example: With ModelInputFieldsMap Range - 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

The following example contains the argument value 'float_input=[1:4]' in ModelInputFieldsMap. In this case, float_input is the ONNX model input name (i.e., tensor name) and it maps to four columns starting at column position 1 and ending with column position 4 in the input table (the first column in table has index 0). The advantage of using the column range is that if you have a lot of columns you don't need to type in each one, you can specify a range. It is still necessary to make sure the order of the columns defined here match with the exact order the model is expecting.

select * from mldb.ONNXPredict(
    on (select * from iris_test)  --- Columns order is important as the base indexes are based off of it
    on (select * from onnx_models where model_id='tf_iris_softmax_onetensor_model') DIMENSION
    using 
        Accumulate('id')
        ModelInputFieldsMap('float_input=[1:4]')
        OverWriteCachedModel('float_input')  – In this example, a new version of the model is replacing the current version in the cache.
) as td
;
 
 *** Query completed. 30 rows found. 2 columns returned.
 *** Total elapsed time was 1 second.
         id  json_report
----------- -----------------------------------------------------------------------
        120       {"probability":[[2.2099151E-8,0.023814192,0.97618586]]}
         85       {"probability":[[1.0646227E-4,0.64747274,0.35242087]]}
        115       {"probability":[[8.84089E-12,1.13627166E-7,0.9999999]]}
         55       {"probability":[[2.3626533E-6,0.9896403,0.010357335]]}
        125       {"probability":[[5.0688627E-9,0.0036252008,0.9963748]]}
         90       {"probability":[[6.0868737E-5,0.9305012,0.06943793]]}
         95       {"probability":[[4.43892E-5,0.98495364,0.015002]]}
        100       {"probability":[[5.467016E-5,0.99671644,0.0032288947]]}
        130       {"probability":[[2.5530914E-8,0.9915139,0.008486167]]}
        135       {"probability":[[1.6936058E-7,0.55152786,0.44847193]]}
        140       {"probability":[[4.6395296E-9,0.004772966,0.995227]]}
         25       {"probability":[[0.99771667,0.0022833364,2.1570362E-11]]}
        110       {"probability":[[5.827173E-11,8.144908E-5,0.9999186]]}
        145       {"probability":[[1.7500341E-11,3.8031712E-6,0.9999962]]}
        150       {"probability":[[2.2181743E-7,0.011317454,0.9886824]]}
         35       {"probability":[[0.999882,1.17950236E-4,2.4415578E-10]]}
         50       {"probability":[[0.99997914,2.0821832E-5,3.7522135E-11]]}
        105       {"probability":[[3.3467944E-11,2.2144119E-5,0.9999778]]}