| reg_rf | R Documentation |
Regression via Random Forests, an ensemble of decision trees trained
on bootstrap samples with random feature subsetting at each split. This wrapper
uses the randomForest package API.
reg_rf(attribute, nodesize = 1, ntree = 10, mtry = NULL)
attribute |
attribute target to model building |
nodesize |
node size |
ntree |
number of trees |
mtry |
number of attributes to build tree |
Random Forests reduce variance and are robust to overfitting on tabular data.
Key hyperparameters are the number of trees (ntree), the number of variables tried at
each split (mtry), and the minimum node size (nodesize).
returns an object of class reg_rfobj
Breiman, L. (2001). Random Forests. Machine Learning 45(1):5–32. Liaw, A. and Wiener, M. (2002). Classification and Regression by randomForest. R News.
data(Boston)
model <- reg_rf("medv", ntree=10)
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.