Teradata Package for Python Function Reference | 17.10 - DecisionForestPredict - 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

Product
Teradata Package for Python
Release Number
17.10
Published
April 2022
Language
English (United States)
Last Update
2022-08-19
lifecycle
previous
Product Category
Teradata Vantage

 
teradataml.analytics.sqle.DecisionForestPredict = class DecisionForestPredict(builtins.object)
     Methods defined here:
__init__(self, object=None, newdata=None, id_column=None, detailed=False, terms=None, newdata_order_column=None, object_order_column=None)
DESCRIPTION:
    The DecisionForestPredict function uses the model generated by
    the DecisionForest function to generate predictions on a response
    variable for a test set of data. The model can be stored in either
    a teradataml DataFrame or a DecisionForest object.
 
 
PARAMETERS:
    object:
        Required Argument.
        Specifies the teradataml DataFrame containing the model data
        or instance of DecisionForest.
 
    object_order_column:
        Optional Argument.
        Specifies Order By columns for object.
        Values to this argument can be provided as a list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    newdata:
        Required Argument.
        Specifies the teradataml DataFrame containing the input test data.
 
    newdata_order_column:
        Optional Argument.
        Specifies Order By columns for newdata.
        Values to this argument can be provided as a list, if multiple
        columns are used for ordering.
        Types: str OR list of Strings (str)
 
    id_column:
        Required Argument.
        Specifies a column containing a unique identifier for each test point 
        in the test set.
        Types: str
 
    detailed:
        Optional Argument.
        Specifies whether to output detailed information about the forest 
        trees; that is, the decision tree and the specific tree information, 
        including task index and tree index for each tree. 
        Default Value: False
        Types: bool
 
    terms:
        Optional Argument.
        Specifies the names of the newdata columns to copy to the output
        teradataml DataFrame.
        Types: str OR list of Strings (str)
 
RETURNS:
    Instance of DecisionForestPredict.
    Output teradataml DataFrames can be accessed using attribute
    references, such as DecisionForestPredictObj.<attribute_name>.
    Output teradataml DataFrame attribute name is:
        result
 
 
RAISES:
    TeradataMlException
 
 
EXAMPLES:
    # Load the data to run the example
    load_example_data("decisionforestpredict", ["housing_train","housing_test"])
 
    # Create teradataml DataFrame objects.
    housing_test = DataFrame.from_table("housing_test")
    housing_train = DataFrame.from_table("housing_train")
 
    # Example 1 -
    # First train the data, i.e., create a decision forest Model
    formula = "homestyle ~ driveway + recroom + fullbase + gashw + airco + prefarea + price + lotsize + bedrooms + bathrms + stories + garagepl"
    rft_model = DecisionForest(data=housing_train,
                              formula = formula,
                              tree_type="classification",
                              ntree=50,
                              tree_size=100,
                              nodesize=1,
                              variance=0.0,
                              max_depth=12,
                              maxnum_categorical=20,
                              mtry=3,
                              mtry_seed=100,
                              seed=100
                              )
 
    # Run predict on the output of decision forest
    decision_forest_predict_out = DecisionForestPredict(object = rft_model,
                                                        newdata = housing_test,
                                                        id_column = "sn",
                                                        detailed = False,
                                                        terms = ["homestyle"]
                                                        )
 
    # Print the results
    print(decision_forest_predict_out.result)
__repr__(self)
Returns the string representation for a DecisionForestPredict class instance.
get_build_time(self)
Function to return the build time of the algorithm in seconds.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
get_prediction_type(self)
Function to return the Prediction type of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
get_target_column(self)
Function to return the Target Column of the algorithm.
When model object is created using retrieve_model(), then the value returned is
as saved in the Model Catalog.
show_query(self)
Function to return the underlying SQL query.
When model object is created using retrieve_model(), then None is returned.