Method new()
Create a new ForwardMarginalEffect object.
Usage
ForwardMarginalEffect$new(
predictor,
features,
ep.method = "none",
compute.nlm = FALSE,
nlm.intervals = 1
)
Arguments
predictor
Predictor object.
features
A named list with the feature name(s) and step size(s).
ep.method
String specifying extrapolation detection method.
compute.nlm
Compute NLM with FMEs? Defaults to FALSE.
nlm.intervals
How many intervals for NLM computation. Defaults to 1.
Returns
A new ForwardMarginalEffect object.
Examples
# Train a model:library(mlr3verse)
library(ranger)
data(bikes, package = "fmeffects")
forest = lrn("regr.ranger")$train(as_task_regr(x = bikes, target = "count"))
# Create an `ForwardMarginalEffect` object:
effects = ForwardMarginalEffect$new(makePredictor(forest, bikes),
features = list("temp" = 1, "humidity" = 0.01),
ep.method = "envelope")
Method compute()
Computes results, i.e., FME (and NLMs) for non-extrapolation points, for a ForwardMarginalEffect object.
Usage
ForwardMarginalEffect$compute()
Returns
A ForwardMarginalEffect object with results.
Examples
# Compute results:
effects$compute()
Plots results, i.e., FME (and NLMs) for non-extrapolation points, for an FME object.
Usage
ForwardMarginalEffect$plot(with.nlm = FALSE, bins = 40, binwidth = NULL)
Arguments
with.nlm
Plots NLMs if computed, defaults to FALSE.
bins
Numeric vector giving number of bins in both vertical and horizontal directions. Applies only to univariate or bivariate numeric effects.
See ggplot2::stat_summary_hex() for details.
binwidth
Numeric vector giving bin width in both vertical and horizontal directions. Overrides bins if both set. Applies only to univariate or bivariate numeric effects.
See ggplot2::stat_summary_hex() for details.
Examples
# Compute results:
effects$plot()
Method clone()
The objects of this class are cloneable with this method.
Usage
ForwardMarginalEffect$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.