Learn R Programming

daltoolbox (version 1.2.747)

reg_dtree: Decision Tree for regression

Description

Regression tree using recursive partitioning via the tree package.

Usage

reg_dtree(attribute)

Value

returns a decision tree regression object

Arguments

attribute

attribute target to model building.

Details

Splits are chosen to reduce squared error within nodes; result is an interpretable set of piecewise constants.

References

Breiman, L., Friedman, J., Olshen, R., and Stone, C. (1984). Classification and Regression Trees. Wadsworth.

Examples

Run this code
data(Boston)
model <- reg_dtree("medv")

# preparing dataset for random sampling
sr <- sample_random()
sr <- train_test(sr, Boston)
train <- sr$train
test <- sr$test

model <- fit(model, train)

test_prediction <- predict(model, test)
test_predictand <- test[,"medv"]
test_eval <- evaluate(model, test_predictand, test_prediction)
test_eval$metrics

Run the code above in your browser using DataLab