Teradata Package for Python Function Reference on VantageCloud Lake - predict - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.

Teradata® Package for Python Function Reference on VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Package for Python
Release Number
20.00.00.11
Publication Date
August 2026
Content Type
Programming Reference
Publication ID
B700-4500-200K
ft:locale
en-US
ft:lastEdition
2026-08-13
ft:sourceId
FTML
dita:id
TeradataPython_FxRef_Lake_2000
Product Category
Teradata Vantage
teradataml.automl.auto_classifier.AutoClassifier.predict = predict(self, data, rank=1, use_loaded_models=False, preserve_columns=False)
DESCRIPTION:
    Function generates prediction on data using model rank in 
    leaderboard.
    Note:
        * If both fit and load method are called before predict, then fit method model will be used
          for prediction by default unless 'use_loaded_models' is set to True in predict.
 
PARAMETERS:
    data:
        Required Argument.
        Specifies the dataset on which prediction needs to be generated 
        using model rank in leaderboard.
        Types: teradataml DataFrame
    
    rank:
        Optional Argument.
        Specifies the rank of the model in the leaderboard to be used for prediction.
        Default Value: 1
        Types: int
    
    use_loaded_models:
        Optional Argument.
        Specifies whether to use loaded models from database for prediction or not.
        Default Value: False
        Types: bool
    
    preserve_columns:
        Optional Argument.
        Specifies whether to preserve input data transformed columns in the output prediction.
        By default, "id_column", "target_column" (if present in input data), prediction and probability 
        columns are present in the output.
        Default Value: False
        Types: bool
 
RETURNS:
    Pandas DataFrame with predictions.
 
RAISES:
    TeradataMlException, TypeError, ValueError
 
EXAMPLES:            
    # Create an instance of the AutoML called "automl_obj" by referring 
    # "AutoML()" or "AutoRegressor()" or "AutoClassifier()" or 
    # "AutoFraud()" or "AutoChurn()" or "AutoCluster()" method.
    # Perform fit() operation on the "automl_obj".
    # Perform predict() operation on the "automl_obj".
    
    # Example 1: Run predict on test data using best performing model.
    >>> prediction = automl_obj.predict(admissions_test)
    >>> prediction
    
    # Example 2: Run predict on test data using second best performing model.
    # Also preserve all columns from input data in output.
    >>> prediction = automl_obj.predict(admissions_test, rank=2, preserve_columns=True)
    >>> prediction
 
    # Example 3: Run predict on test data using loaded model.
    >>> automl_obj.load("model_table")
    >>> prediction = automl_obj.predict(admissions_test, rank=3)
    >>> prediction
 
    # Example 4: Run predict on test data using loaded model when fit is also called.
    >>> automl_obj.fit(admissions_train, "admitted")
    >>> automl_obj.load("model_table")
    >>> prediction = automl_obj.predict(admissions_test, rank=3, use_loaded_models=True)
    >>> prediction