DataRobotPredict Input | Vantage BYOM - DataRobotPredict Input - 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
Input Table Description
InputTable Table containing columns of data to score.
ModelTable Table containing one column identifying each model and a model column that stores each DataRobot model as a BLOB.
When ModelTable contains more than one model, you must use a SELECT query with a WHERE clause to select the model, otherwise an error occurs.

ModelTable must be specified as DIMENSION, otherwise an error occurs.

Date type requirements

The DataRobot scoring library requires date types to be in the same format as the one used to train the DataRobot model. You must convert the InputTable columns containing DATE or TIMESTAMP types to character type.

You can do this by forcing a FORMAT on CAST to convert DATE to character or using the TO_CHAR function in the column with DATE or TIMESTAMP from the input table.

For example, if a model has a feature BestDate whose train data in the DataRobot AI platform was in the format of MM/dd/yyyy (05/24/2022) and the Teradata table contains the column BestDate of DATE type, it can be cast to Character using TO_CHAR. For more information, see Teradata Vantage™ - SQL Functions, Expressions, and Predicates.

Example: Cast DATE
SELECT * FROM TD_mldb.DataRobotPredict(
    ON (
        SELECT
          wine_id,
          winetype,
          total_sulfur_dioxide,
          free_sulfur_dioxide,
          fixed_acidity,
          volatile_acidity,
          alcohol,
          citric_acid,
          residual_sugar,
          quality,
          chlorides,
          density,
          pH,
          sulphates,
          grapes,
          TO_CHAR(BestDate, 'MM/dd/yyyy') BestDate,
        FROM wines_date
    ) AS InputTable
    ON (
        SELECT * FROM datarobot_models
        WHERE model_id = 'dr_wi_rf_type1datestimes'
    ) AS ModelTable DIMENSION
    USING
        Accumulate('wine_id')
) AS td;

If a model has the feature BestDateTime whose train data in the DataRobot AI platform was in the format MM/dd/yyyy HH:mm (05/24/2022 23:45) and the Teradata InputTable contains the column BestDateTime of TIMESTAMP type, it can be cast by forcing a FORMAT on CAST for converting DATE to Character.

Example: Cast DATE
SELECT * FROM TD_mldb.DataRobotPredict(
    ON (
        SELECT
          wine_id,
          winetype,
          total_sulfur_dioxide,
          free_sulfur_dioxide,
          fixed_acidity,
          volatile_acidity,
          alcohol,
          citric_acid,
          residual_sugar,
          quality,
          chlorides,
          density,
          pH,
          sulphates,
          grapes,
          CAST(CAST(BestDateTime AS FORMAT 'MM/DD/YYBHH:MI') AS CHAR(20)) BestDateTime,
        FROM wines_date
    ) AS InputTable
    ON (
        SELECT * FROM datarobot_models
        WHERE model_id = 'dr_wi_rf_type1datestimes'
    ) AS ModelTable DIMENSION
    USING
        Accumulate('wine_id')
) AS td;

For more information, see the format_arg information in Teradata Vantage™ - SQL Functions, Expressions, and Predicates.