| PDP | R Documentation |
Calculates the Partial Dependency Plot for one feature, either numeric or categorical. Returns it as a plot.
PDP(
model,
variable = NULL,
data = NULL,
ice = FALSE,
resolution.ice = 20,
plot = TRUE,
parallel = FALSE,
...
)
## S3 method for class 'citodnn'
PDP(
model,
variable = NULL,
data = NULL,
ice = FALSE,
resolution.ice = 20,
plot = TRUE,
parallel = FALSE,
...
)
## S3 method for class 'citodnnBootstrap'
PDP(
model,
variable = NULL,
data = NULL,
ice = FALSE,
resolution.ice = 20,
plot = TRUE,
parallel = FALSE,
...
)
model |
a model created by |
variable |
variable (as a string) for which the PDP should be computed. If none is supplied, it is computed for all variables. |
data |
new data on which the PDP should be computed. If NULL, the PDP is computed on the training data. |
ice |
if TRUE, the Individual Conditional Expectation (ICE) curves are also shown |
resolution.ice |
resolution (number of grid points) at which the ICE curves are computed |
plot |
whether to plot the PDP |
parallel |
whether to parallelize over the bootstrap models |
... |
arguments passed to |
A list of plots made with 'ggplot2', one for each selected variable.
Performs a partial dependence plot (PDP) estimation to analyze the relationship between a selected feature and the model's predictions.
The PDP function estimates the partial function \hat{f}_S:
\hat{f}_S(x_S)=\frac{1}{n}\sum_{i=1}^n\hat{f}(x_S,x^{(i)}_{C})
using a Monte Carlo estimation, i.e. it computes the average prediction over the data while the selected feature is held fixed at a given value and the remaining features are kept at their observed values.
For categorical features, every observation is set to each level of the feature in turn, the average prediction per level is calculated, and the result is shown as a bar plot.
If ice = TRUE, the Individual Conditional Expectation (ICE) curves are also shown, with the PDP highlighted in yellow. Each ICE curve illustrates how the prediction for a single observation changes as the feature varies. ICE curves are computed on a value grid rather than at every observed feature value, and are not available for categorical features.
ALE
if(torch::torch_is_installed()){
library(cito)
# Build and train Network
nn.fit<- dnn(Sepal.Length~., data = datasets::iris)
PDP(nn.fit, variable = "Petal.Length")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.