DataRobotPredict Example NOS | Vantage BYOM - DataRobotPredict Example: NOS - 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
For this example:
1. Update the variables USER and PASSWORD in "CREATE AUTHORIZATION sqlert_master_usr" with the credentials you use to access your AWS S3 bucket
2. Place the file load_iris_input_Test.csv from the inputData folder into your AWS S3 bucket
3. Update the LOCATION to the file load_iris_input_Test.csv in your AWS S3 bucket
 
DROP AUTHORIZATION sqlert_master_usr;
 
CREATE AUTHORIZATION sqlert_master_usr
    USER 'YOURUSER'
    PASSWORD 'YOURPASSWORD123';
 
SELECT * FROM td_mldb.DataRobotPredict(
    ON (SELECT TOP 10 CAST(id AS INTEGER) id,
        CAST(sepal_length AS FLOAT) sepal_length,
        CAST(sepal_width AS FLOAT) sepal_width,
        CAST(petal_length AS FLOAT) petal_length,
        CAST(petal_width AS FLOAT) petal_width,
        CAST(species AS VARCHAR(5)) species
        FROM (
        LOCATION='/s3/s3.amazonaws.com/yourbucket/load_iris_input_Test.csv'
        AUTHORIZATION=sqlert_master_usr
        ) AS t ORDER BY 1,2,3,4,5,6) AS InputTable 
    ON (SELECT * FROM datarobot_models WHERE model_id='dr_iris_rf') AS ModelTable DIMENSION
    USING
    Accumulate('*')
    OverwriteCachedModel('1')
) AS td ORDER BY 1,2,3,4,5,6;
 
 *** Query completed. 10 rows found. 8 columns returned.
 *** Total elapsed time was 15 seconds.
  id      sepal_length            sepal_width           petal_length            petal_width species prediction                json_report
----- ---------------------- ---------------------- ---------------------- ---------------------- ------- ------------------------- -------------------------------------------------------------------------------------------------------
    1  5.10000000000000E 000  3.50000000000000E 000  1.40000000000000E 000  2.00000000000000E-001 1       '1'                       {"1":"1.0","2":"0.0","3":"0.0","species":"'1'","all_class_labels":"['1', '2', '3']","'3'":"0.0","all_class_probs":"[1.0, 0.0, 0.0]","'2'":"0.0","'1'":"1.0"}
    2  4.90000000000000E 000  3.00000000000000E 000  1.40000000000000E 000  2.00000000000000E-001 1       '1'                       {"1":"1.0","2":"0.0","3":"0.0","species":"'1'","all_class_labels":"['1', '2', '3']","'3'":"0.0","all_class_probs":"[1.0, 0.0, 0.0]","'2'":"0.0","'1'":"1.0"}
    3  4.70000000000000E 000  3.20000000000000E 000  1.30000000000000E 000  2.00000000000000E-001 1       '1'                       {"1":"1.0","2":"0.0","3":"0.0","species":"'1'","all_class_labels":"['1', '2', '3']","'3'":"0.0","all_class_probs":"[1.0, 0.0, 0.0]","'2'":"0.0","'1'":"1.0"}
    4  4.60000000000000E 000  3.10000000000000E 000  1.50000000000000E 000  2.00000000000000E-001 1       '1'                       {"1":"1.0","2":"0.0","3":"0.0","species":"'1'","all_class_labels":"['1', '2', '3']","'3'":"0.0","all_class_probs":"[1.0, 0.0, 0.0]","'2'":"0.0","'1'":"1.0"}
    5  5.00000000000000E 000  3.60000000000000E 000  1.40000000000000E 000  2.00000000000000E-001 1       '1'                       {"1":"1.0","2":"0.0","3":"0.0","species":"'1'","all_class_labels":"['1', '2', '3']","'3'":"0.0","all_class_probs":"[1.0, 0.0, 0.0]","'2'":"0.0","'1'":"1.0"}  

...