Create a detailed model with lm smoother
sculpt_detailed_lm.Rd
Create a detailed model with lm smoother
Arguments
- rs
Rough model, i.e. object of classes
rough
andsculpture
.- missings
(
NULL
) or single value or a named vector. Specifies the value(-s) that stand for the missing values. IfNULL
, then no missing value handling is carried out. If single value, then it is assumed that this value is used for flagging missing values across all continuous variables. If named vector, then the names are used to refer to continuous variables and the values for flagging missing values in that variable.- verbose
(
integer
) 0 for silent run, > 0 for messages.- allow_par
(
logical
) Allow parallel computation? Defaults toFALSE
.
Details
For parallel computation, use parallel_set()
and set allow_par
to TRUE
.
Note that parallel computation may fail if the model is too big and there is not enough memory.
Examples
df <- mtcars
df$vs <- as.factor(df$vs)
model <- rpart::rpart(
hp ~ mpg + carb + vs,
data = df,
control = rpart::rpart.control(minsplit = 10)
)
model_predict <- function(x) predict(model, newdata = x)
covariates <- c("mpg", "carb", "vs")
pm <- sample_marginals(df[covariates], n = 50, seed = 5)
rs <- sculpt_rough(
dat = pm,
model_predict_fun = model_predict,
n_ice = 10,
seed = 1,
verbose = 0
)
ds <- sculpt_detailed_lm(rs)
class(ds)
#> [1] "detailed" "sculpture" "list"