-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BART models give different predictions #1247
Comments
For prediction, BART takes a sample from the predictive posterior distribution. If you set the seed right before running > set.seed(1)
> bart_final %>%
+ extract_workflow() %>%
+ predict(data_test) %>%
+ pluck(".pred") %>%
+ head()
[1] 5.161443 4.613805 4.646856 4.951699 5.045785 5.118415
>
> set.seed(2)
> bart_final %>%
+ extract_workflow() %>%
+ predict(data_test) %>%
+ pluck(".pred") %>%
+ head()
[1] 5.179751 4.620760 4.658856 4.953538 5.058127 5.118422
>
> set.seed(2)
> bart_final %>%
+ extract_workflow() %>%
+ predict(data_test) %>%
+ pluck(".pred") %>%
+ head()
[1] 5.179751 4.620760 4.658856 4.953538 5.058127 5.118422 The problem you're seeing is that |
@topepo That explains it then, thank you |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
The problem
I'm having trouble with using the final fitted model to generate predictions for the BART algorithm. Using the fitted workflow to predict data produces different predictions everytime it is run. Other algorithms from parsnip give the same predictions whenever they are run multiple times. Is this intended for BART models? I can get stable predictions when set.seed() is used but I'm not sure whether this is intended behavior or a bug.
The code below is an example from my original code but adapted to the iris dataset. I've run the code with and without parallel processing (in the current code parallel processing is turn off), but I get the same results (different predictions when run multiple times).
Reproducible example
The text was updated successfully, but these errors were encountered: