Skip to content

Commit 212765f

Browse files
committed
Engine specific defaults for random forest
1 parent 16c0271 commit 212765f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

man/rmd/rand-forest.Rmd

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,27 @@ rand_forest() %>%
6565
## Parameter translations
6666

6767
The standardized parameter names in parsnip can be mapped to their original
68-
names in each engine that has main parameters:
68+
names in each engine that has main parameters. Each engine typically has a
69+
different default value (shown in parentheses) for each parameter.
6970

7071
```{r echo = FALSE, results = "asis"}
72+
get_defaults_rand_forest <- function() {
73+
tibble::tribble(
74+
~model, ~engine, ~parsnip, ~original, ~default,
75+
"rand_forest", "ranger", "trees", "num.trees", get_arg("ranger", "ranger", "num.trees"),
76+
"rand_forest", "ranger", "mtry", "mtry", "see below",
77+
"rand_forest", "ranger", "min_n", "min.node.size", "see below",
78+
"rand_forest", "randomForest", "trees", "ntree", get_arg("randomForest", "randomForest.default", "ntree"),
79+
"rand_forest", "randomForest", "mtry", "mtry", "see below",
80+
"rand_forest", "randomForest", "min_n", "nodesize", "see below",
81+
"rand_forest", "spark", "trees", "num_trees", get_arg("sparklyr", "ml_random_forest", "num_trees"),
82+
"rand_forest", "spark", "mtry", "feature_subset_strategy", "see below",
83+
"rand_forest", "spark", "min_n", "min_instances_per_node", get_arg("sparklyr", "ml_random_forest", "min_instances_per_node"),
84+
)
85+
}
7186
parsnip::convert_args("rand_forest")
7287
```
7388

89+
- The default `min_n` for both ranger and randomForest is 1 for classification and 5 for regression.
90+
- For randomForest and spark, the default `mtry` is the square root of the number of predictors for classification, and one-third of the predictors for regression.
91+
- For ranger, the default `mtry` is the square root of the number of predictors.

0 commit comments

Comments
 (0)