gabri
1
An error occurred while trying to analyze the random forest model.
Could somebody help me?
There is an error message at the bottom.
library(palmerpenguins)
penguins
penguins %>%
filter(!is.na(sex)) %>%
ggplot(aes(flipper_length_mm, bill_length_mm, color = sex, size = body_mass_g)) +
geom_point(alpha = 0.5) +
facet_wrap(~species)
penguins_df <- penguins %>%
filter(!is.na(sex)) %>%
select(-year, -island)
library(tidymodels)
set.seed(123)
penguin_split <- initial_split(penguins_df, strata = sex)
penguin_train <- training(penguin_split)
penguin_test <- testing(penguin_split)
set.seed(123)
penguin_boot <- bootstraps(penguin_train)
penguin_boot
rf_spec <- rand_forest() %>%
set_mode("classification") %>%
set_engine("ranger")
rf_spec
penguin_wf <- workflow() %>%
add_formula(sex ~ .)
rf_rs <- penguin_wf %>%
add_model(rf_spec) %>%
fit_resamples(
resamples = penguin_boot,
control = control_resamples(save_pred = TRUE))
#error message
x Bootstrap01: preprocessor 1/1, model 1/1: Error in rangerCpp(treetype, x, y.m...
Hi, it ran for me without any issues.
> rf_rs
# Resampling results
# Bootstrap sampling
# A tibble: 25 × 5
splits id .metrics .notes .predictions
<list> <chr> <list> <list> <list>
1 <split [250/93]> Bootstrap01 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [93 × 6]>
2 <split [250/92]> Bootstrap02 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [92 × 6]>
3 <split [250/90]> Bootstrap03 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [90 × 6]>
4 <split [250/92]> Bootstrap04 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [92 × 6]>
5 <split [250/86]> Bootstrap05 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [86 × 6]>
6 <split [250/88]> Bootstrap06 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [88 × 6]>
7 <split [250/96]> Bootstrap07 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [96 × 6]>
8 <split [250/89]> Bootstrap08 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [89 × 6]>
9 <split [250/96]> Bootstrap09 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [96 × 6]>
10 <split [250/90]> Bootstrap10 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [90 × 6]>
# … with 15 more rows
Have you got the latest version of the packages perhaps?
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.