PDP {cito} R Documentation

## Partial Dependence Plot (PDP)

### Description

Calculates the Partial Dependency Plot for one feature, either numeric or categorical. Returns it as a plot.

### Usage

PDP(model, variable = NULL, data = NULL, ice = FALSE, resolution.ice = 20)


### Arguments

 model a model created by dnn variable variable as string for which the PDP should be done. If none is supplied it is done for all variables. data specify new data PDP should be performed . If NULL, PDP is performed on the training data. ice Individual Conditional Dependence will be shown if TRUE resolution.ice resolution in which ice will be computed

### Details

Performs the estimation of 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})

with a Monte Carlo Estimation:

\hat{f}_S(x_S)=\frac{1}{n}\sum_{i=1}^n\hat{f}(x_S,x^{(i)}_{C})

If a categorical feature is analyzed, all data instances are used and set to each level. Then an average is calculated per category and put out in a bar plot.

If ice is set to true additional the individual conditional dependence will be shown and the original PDP will be colored yellow. These lines show, how each individual data sample reacts to changes in the feature. This option is not available for categorical features. Unlike PDP the ICE curves are computed with a value grid instead of utilizing every value of every data entry.

### Value

A list of plots made with 'ggplot2' consisting of an individual plot for each defined variable.

ALE

### Examples


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")
}



[Package cito version 1.0.0 Index]