Teradata Package for R Function Reference | 17.00 - 17.00 - td_decision_tree_evaluator_valib - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)

Description

The function creates confusion matrix as XML output string, displaying counts of predicted versus actual values of the dependent variable of the decision tree model. It also contains counts of correct and incorrect predictions. The function also generates two profile DataFrames containing the details about the decisions made during the prediction.

Usage

td_decision_tree_evaluator_valib(model, data, ...)

Arguments

model

Required Argument.
Specifies an object of class tbl_teradata generated by td_decision_tree_valib() function, containing the decision tree model in PMML format that is used to predict the data.
Types: tbl_teradata

data

Required Argument.
Specifies the input data containing the columns to analyse, representing the dependent and independent variables in the analysis.
Types: tbl_teradata

...

Specifies other arguments supported by the function as described in the 'Other Arguments' section.

Value

Function returns an object of class "td_decision_tree_evaluator_valib" which is a named list containing objects of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using names:

  1. result

  2. profile.result.1

  3. profile.result.2

Other Arguments

include.confidence

Optional Argument.
Specifies whether the output tbl_teradata contain a column indicating how likely it is, for a particular leaf node on the tree, that the prediction is correct. If not specified or set to 'FALSE', the confidence column is not created.
Note: This argument cannot be specified along with "targeted.value" argument.
Default Value: FALSE
Types: logical

index.columns

Optional Argument.
Specifies one or more different columns for the primary index of the result output tbl_teradata. By default, the primary index columns of the result output tbl_teradata are the primary index columns of the input tbl_teradata "data". In addition, the columns specified in this argument need to form a unique key for the result output tbl_teradata. Otherwise, there are more than one score for a given observation.
Types: character OR list of Strings (character)

response.column

Optional Argument.
Specifies the name of the predicted value column. If this argument is not specified, the name of the dependent column in "data" tbl_teradata is used.
Types: character

accumulate

Optional Argument.
Specifies one or more columns from the "data" tbl_teradata that can be passed to the result output tbl_teradata.
Types: character OR list of Strings (character)

Examples

# Notes:
#   1. To execute Vantage Analytic Library functions, set option 'val.install.location' to
#      the database name where Vantage analytic library functions are installed.
#   2. Datasets used in these examples can be loaded using Vantage Analytic Library installer.

# Set the option 'val.install.location'.
options(val.install.location = "SYSLIB")

# Get remote data source connection.
con <- td_get_context()$connection

# Create an object of class "tbl_teradata".
df <- tbl(con, "customer_analysis")
print(df)

# Run DecisionTree() on columns "age", "income" and "nbr_children", with dependent 
# variable "gender".
dt_obj <- td_decision_tree_valib(data=df,
                                 columns=c("age", "income", "nbr_children"),
                                 response.column="gender",
                                 algorithm="gainratio",
                                 binning=FALSE,
                                 max.depth=5,
                                 num.splits=2,
                                 pruning="gainratio")

# Evaluate the decision tree model generated above.
obj <- td_decision_tree_evaluator_valib(data=df,
                                        model=dt_obj$result,
                                        accumulate=c("city_name", "state_code"))
# Print the results.
print(obj$result)
print(obj$profile.result.1)
print(obj$profile.result.2)