rmw_partial_dependencies {rmweather} | R Documentation |
Function to calculate partial dependencies after training with rmweather.
Description
rmw_plot_partial_dependencies
is rather slow.
Usage
rmw_partial_dependencies(
model,
df,
variable,
training_only = TRUE,
resolution = NULL,
n_cores = NA,
verbose = FALSE
)
Arguments
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? |
Value
Tibble.
Author(s)
Stuart K. Grange
Examples
# 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
)
[Package rmweather version 0.2.6 Index]