bonsai
bonsai copied to clipboard
`aorsf` - engine: model fit fails if `mtry` is specified
Hi,
the model fit fails if mtry
is specified for the aorsf
-engine. If it is not specified, it works with the default engine values.
library(bonsai)
#> Loading required package: parsnip
# This works with default mtry value
rf_mod <-
rand_forest() %>%
set_engine(engine = "aorsf") %>%
set_mode(mode = "regression") %>%
set_args(min_n = 1, trees = 2, importance = "permute") %>%
fit(
formula = mpg ~ . ,
data = mtcars
)
rf_mod
#> parsnip model object
#>
#> ---------- Oblique random regression forest
#>
#> Linear combinations: Accelerated Linear regression
#> N observations: 32
#> N trees: 2
#> N predictors total: 10
#> N predictors per node: 4
#> Average leaves per tree: 7.5
#> Min observations in leaf: 1
#> OOB stat value: 0.27
#> OOB stat type: RSQ
#> Variable importance: permute
#>
#> -----------------------------------------
# Error occurs...
rf_mod_w_mtry <-
rand_forest() %>%
set_engine(engine = "aorsf") %>%
set_mode(mode = "regression") %>%
set_args(mtry = 3, min_n = 1, trees = 2, importance = "permute") %>%
fit(
formula = mpg ~ . ,
data = mtcars
)
#> Error in ncol(source): object 'x' not found
Created on 2024-08-08 with reprex v2.0.2
Thank you in advance and best regards