TDPredictor.predict Method |teradataml AWS Extension Library | API Integration - TDPredictor.predict Method - Teradata VantageCloud Lake

Lake - Analyze Your Data with ClearScape Analytics™

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2026-02-20
dita:mapPath
tcl1683670667798.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
tcl1683670667798

Use the TDPredictor.predict method to perform prediction using teradataml DataFrame and SageMaker endpoint represented by this predictor object.

Required Arguments:
  • input: Specifies the teradataml DataFrame used as input for scoring.
  • mode: Specifies the mode for scoring.
    Permitted values include:
    • 'UDF': Score in database using a Teradata UDF. This is the default value.

      For this mode, the return is a teradataml DataFrame.

      This mode provides faster scoring with the data from Teradata.

    • 'CLIENT': Score at client side using a library.

      For this mode, the return is an array or JSON.

      When using mode, data is pulled from Teradata and serialized for scoring at client.

Optional Argument:
  • options: Specifies the predict method with the following key-value arguments:
    • udf_name: Specifies the name of the UDF used to invoke predict with UDF mode. Default value is 'tapidb.API_Request'.
    • content_type: Specifies content type required for SageMaker endpoint present in the predictor. Default value is 'csv'.
    • key_start_index: Specifies the index in DataFrame columns to be the key for scoring starts. Default value is 0.

Example

from tdapiclient import create_tdapi_context, TDApiClient
from teradataml import DataFrame
context = create_tdapi_context("aws", "s3_bucket")
tdapiclient = TDApiClient(context)
# SKlearn takes all parameters that AWS SageMaker Library requires
skLearnObject = tdapiclient.SKLearn()
df = DataFrame(tableName='t')
skLearnObject.fit(df)
predictor = skLearnObject.deploy(sagemaker_kw_args={"instance_type": "ml.m5.large", "initial_instance_count": 1})
df = DataFrame(tableName='inputTable')
outputDF = predictor.predict(df, mode='UDF', content_type='csv')