API_Request In-database Function Usage | Amazon SageMaker | Teradata Vantage - API_Request In-database Function Usage - Teradata Vantage

Teradata Vantage™ - API Integration Guide for Cloud Machine Learning

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
1.4
Published
September 2023
Language
English (United States)
Last Update
2023-09-28
dita:mapPath
mgu1643999543506.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
mgu1643999543506

Usage Considerations

The API_Request in-database function is used for model scoring and inference calculations.

Before using the API_Request in-database function, the AWS endpoint of Amazon SageMaker or analytic model should have been trained and deployed on AWS.

You also need the endpoint address, region and AWS credentials (which have permissions to use this in-database function) to execute a query to score Vantage data with this AWS analytic service.

Usage Example: Use SageMaker Endpoint for Scoring Vantage Data

In this example, an Amazon SageMaker model has been deployed to the AWS US-East-2 region with the endpoint 'sagemaker-xgboost-2021-10-20-15-43-44-623'. The authentication fields are intentionally left as ‘replace with your AWS credentials’. The expected input fields to this AWS analytic model are in the Vantage table ‘NEW_FINANCIAL_TRANS’.

SELECT rec_id, output as fraud_risk_score 
FROM tapidb.API_Request 
( 
  ON NEW_FINANCIAL_TRANS 
  USING AUTHORIZATION('{"Access_ID":"replace with your AWS Access ID", 
                        "Session_Token":"replace with your AWS Session Token", 
                        "Region":"us-east-2"}') 
  ENDPOINT('sagemaker-xgboost-2021-10-20-15-43-44-623') 
  CONTENT_TYPE('csv')  
  KEY_START_INDEX('1') 
) as DT 
; 

API_Request query result:

        rec_id fraud_risk_score
              597417 0.8734374642372131
              392307 0.5901673436164856
               52268 0.9538228511810303
               76809 0.47017282247543335
              744410 0.9500066637992859
              751493 0.5542758703231812
              676641 0.881127119064331
              146036 0.9368776082992554
              631585 0.42199018597602844
               45837 0.4777362048625946
               51034 0.2817979156970978
              484301 0.9431955814361572
              603917 0.9265019297599792
              554445 0.7330561280250549
               12892 0.6860849857330322