View source: R/rmw_partial_dependencies.R
rmw_partial_dependencies | R Documentation |
rmw_plot_partial_dependencies
is rather slow.
rmw_partial_dependencies(
model,
df,
variable,
training_only = TRUE,
resolution = NULL,
n_cores = NA,
verbose = FALSE
)
model |
A ranger model object from |
df |
Input data frame after preparation with
|
variable |
Vector of variables to calculate partial dependencies for. |
training_only |
Should only the training set be used for prediction? The
default is |
resolution |
The number of points that should be predicted for each
independent variable. If left as |
n_cores |
Number of CPU cores to use for the model calculation. The default is system's total minus one. |
verbose |
Should the function give messages? |
Tibble.
Stuart K. Grange
# Load packages
library(dplyr)
# Ranger package needs to be loaded
library(ranger)
# Prepare example data
data_london_prepared <- data_london %>%
filter(variable == "no2") %>%
rmw_prepare_data()
# Calculate partial dependencies for wind speed
data_partial <- rmw_partial_dependencies(
model = model_london,
df = data_london_prepared,
variable = "ws",
verbose = TRUE
)
# Calculate partial dependencies for all independent variables used in model
data_partial <- rmw_partial_dependencies(
model = model_london,
df = data_london_prepared,
variable = NA,
verbose = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.