| |
Methods defined here:
- __init__(self, object=None, newdata=None, id_column=None, detailed=False, terms=None, output_response_probdist=False, output_responses=None, newdata_sequence_column=None, object_sequence_column=None, newdata_order_column=None, object_order_column=None)
- DESCRIPTION:
The DecisionForestPredict function uses the model generated by the
DecisionForest 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.
Note: This function is available only when teradataml is connected to
Vantage 1.1 or later versions.
PARAMETERS:
object:
Required Argument.
Specifies the teradataml DataFrame containing the model data
or instance of DecisionForest, which contains the model.
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 input columns to copy to the output
teradataml DataFrame.
Types: str OR list of Strings (str)
output_response_probdist:
Optional Argument.
Specifies whether to output probabilities.
Note: "output_response_probdist" argument support is only available
when teradataml is connected to Vantage 1.1.1 or later.
Default Value: False
Types: bool
output_responses:
Optional Argument.
Specifies all responses in input table.
This argument requires the output_response_probdist argument to be set to True.
Note: "output_responses" argument support is only available when
teradataml is connected to Vantage 1.1.1 or later.
Types: str OR list of Strings (str)
newdata_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "newdata". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: str OR list of Strings (str)
object_sequence_column:
Optional Argument.
Specifies the list of column(s) that uniquely identifies each row of
the input argument "object". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
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 - This example uses home sales data to create a
# classifcation tree that predicts home style, which can be input
# to the DecisionForestPredict.
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
)
# Use the rft_model, the model created by DecisionForest to generate
# predictions on a response variable for a test set of data, housing_test
# which has 54 observations of 14 variables.
decision_forest_predict_out = DecisionForestPredict(object = rft_model,
newdata = housing_test,
id_column = "sn",
detailed = False,
terms = ["homestyle"],
newdata_sequence_column='sn',
object_sequence_column='worker_ip',
newdata_order_column=['sn', 'price'],
object_order_column=['worker_ip', 'task_index']
)
# 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.
|