Teradata Package for Python Function Reference | 20.00 - 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 - 20.00
- Deployment
- VantageCloud
- VantageCore
- Edition
- Enterprise
- IntelliFlex
- VMware
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Enterprise_2000
- Product Category
- Teradata Vantage
- teradataml.automl.__init__.AutoRegressor.predict = predict(self, data, rank=1, use_loaded_models=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
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()" 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.
>>> prediction = automl_obj.predict(admissions_test, rank=2)
>>> 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