Description
The DecisionForest function uses a training data set to generate a
predictive model. You can input the model to the function
DecisionForestPredict (td_decision_forest_predict_mle
or td_decision_forest_predict_sqle
)
function, which uses it to make predictions.
Usage
td_decision_forest_mle (
formula = NULL,
data = NULL,
maxnum.categorical = 20,
tree.type = NULL,
ntree = NULL,
tree.size = NULL,
nodesize = 1,
variance = 0,
max.depth = 12,
mtry = NULL,
mtry.seed = NULL,
seed = NULL,
outofbag = FALSE,
display.num.processed.rows = FALSE,
categorical.encoding = "graycode",
data.sequence.column = NULL
)
Arguments
formula |
Required Argument. |
data |
Required Argument. |
maxnum.categorical |
Optional Argument. |
tree.type |
Optional Argument. |
ntree |
Optional Argument. |
tree.size |
Optional Argument. |
nodesize |
Optional Argument. |
variance |
Optional Argument. |
max.depth |
Optional Argument. |
mtry |
Optional Argument. |
mtry.seed |
Optional Argument. |
seed |
Optional Argument. |
outofbag |
Optional Argument. |
display.num.processed.rows |
Optional Argument. |
categorical.encoding |
Optional Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_decision_forest_mle" which is a named list containing object of class "tbl_teradata". Named list members can be referenced directly with the "$" operator using following names:
predictive.model
monitor.table
output
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
loadExampleData("decisionforest_example", "housing_train", "boston")
# Create object(s) of class "tbl_teradata".
housing_train <- tbl(con, "housing_train")
boston <- tbl(con, "boston")
# Example 1 -
td_decision_forest_out1 <- td_decision_forest_mle(
formula = (homestyle ~ bedrooms + lotsize + gashw + driveway +
stories + recroom + price + garagepl +
bathrms + fullbase + airco + prefarea),
data = housing_train,
tree.type = "classification",
ntree = 50,
nodesize = 1,
variance = 0.0,
max.depth = 12,
mtry = 3,
mtry.seed = 100,
seed = 100
)
# Example 2 -
td_decision_forest_out2 <- td_decision_forest_mle(
formula = (homestyle ~ bedrooms + lotsize + gashw + driveway +
stories + recroom + price + garagepl +
bathrms + fullbase + airco + prefarea),
data = housing_train,
tree.type = "classification",
ntree = 50,
nodesize = 2,
max.depth = 12,
mtry = 3,
outofbag = TRUE
)
# Example 3 -
td_decision_forest_out3 <- td_decision_forest_mle(
formula = (medv ~ indus + ptratio + lstat + black + tax + dis +
zn + rad + nox + chas + rm + crim + age),
data = boston,
tree.type = "regression",
ntree = 50,
nodesize = 2,
max.depth = 6,
outofbag = TRUE
)