-
Notifications
You must be signed in to change notification settings - Fork 89
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
Sampling from estimated conditional distributions using different predict() methods #375
Comments
On your first question, you need to use library(tidymodels)
library(partykit)
#> Loading required package: grid
#> Loading required package: libcoin
#> Loading required package: mvtnorm
cart_model <- parsnip::decision_tree() %>%
parsnip::set_engine("rpart") %>%
parsnip::set_mode("regression")
cart_fit <- fit(cart_model, mpg ~ ., data = mtcars)
fixed_fit <- repair_call(cart_fit, data = mtcars)
as.party(fixed_fit$fit)
#>
#> Model formula:
#> mpg ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb
#>
#> Fitted party:
#> [1] root
#> | [2] cyl >= 5
#> | | [3] hp >= 192.5: 13.414 (n = 7, err = 28.8)
#> | | [4] hp < 192.5: 18.264 (n = 14, err = 59.9)
#> | [5] cyl < 5: 26.664 (n = 11, err = 203.4)
#>
#> Number of inner nodes: 2
#> Number of terminal nodes: 3 Created on 2020-10-05 by the reprex package (v0.3.0.9001) |
I don't want to maintain The nice thing about I started on In general though, if there is something that you want to implement and maintain, take a look at the help documentation and add issues here in case you run into issues. |
Going to go ahead and close as this hasn't come to the top of our to-do in the last 4 years. Generally, though, while you can't |
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. |
Feature
I have a specific question and a general feature request/question.
I sometimes sample from nodes in regression trees instead of using node means. For example, I can use
library(partykit)
to sample from the nodes:The process above is clunky and does not generalize across models or packages. It also doesn't work with
library(parsnip)
:as.party()
work in this situation?The text was updated successfully, but these errors were encountered: