Teradata Package for R Function Reference | 17.00 - 17.00 - DecisionForestEvaluator - 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 DecisionForestEvaluator function analyzes the model generated by the DecisionForest (td_decision_forest_mle) function and assigns weights to the model variables. The variable/attribute counts in each tree level help you understand the importance of different variables in the decision-making process.

Usage

  td_decision_forest_evaluator_mle (
      object = NULL,
      num.levels = 5,
      object.sequence.column = NULL,
      object.order.column = NULL
  )

Arguments

object

Required Argument.
Specifies the model tbl_teradata generated by td_decision_forest_mle.
This argument can accept either a tbl_teradata or an object of "td_decision_forest_mle" class.

object.order.column

Optional Argument.
Specifies Order By columns for "object".
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

num.levels

Optional Argument.
Specifies number of levels to analyze.
Default Value: 5
Types: integer

object.sequence.column

Optional Argument.
Specifies the vector 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: character OR vector of Strings (character)

Value

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

Examples

    # Get the current context/connection
    con <- td_get_context()$connection

    # Load example data.
    loadExampleData("decisionforest_example","housing_train")

    # Create object(s) of class "tbl_teradata".
    housing_train <- tbl(con, "housing_train")

    # First train the data, i.e., create a decision forest model
    td_decision_forest_out <- td_decision_forest_mle(data = housing_train,
                                  formula = (homestyle ~ bedrooms + lotsize + gashw + driveway +
                                                         stories + recroom + price + garagepl +
                                                         bathrms + fullbase + airco + prefarea),
                                  tree.type = "classification",
                                  nodesize = 1,
                                  variance = 0,
                                  max.depth = 12,
                                  maxnum.categorical = 20,
                                  mtry = 100,
                                  seed = 100,
                                  ntree = 50
                                  )

    # Analyze generated output.
    decision_forest_evaluator_out <- td_decision_forest_evaluator_mle(
                                                           object = td_decision_forest_out,
                                                           num.levels = 5
                                                           )