plot_partial_dependencies: Function for plotting the partial dependencies of the created...

Description Usage Arguments Value Examples

View source: R/neural_net_visualization.R

Description

plot_partial_dependencies creates the partial dependence plot for the specified predictors.

Usage

1
2
3
plot_partial_dependencies(neural_net, predictors = "all", probs = c(0,
  0), type = "ggplot", nrepetitions = 50, parallel = FALSE,
  use_stored_data = FALSE)

Arguments

neural_net

The NeuralNetwork instance, see: NeuralNetwork

predictors

Vector of predictors of the neural network for which to plot the partial dependencies.

probs

Vector of lower and upper bound probabilities for the confidence interval. If both are 0, intervals will not be plotted.

type

Either 'ggplot' if the plot should be created using 'ggplot' or 'ggplotly' if plotly should be used.

nrepetitions

Number of samples used within bootstrap for confidence intervals.

parallel

Boolean specifying if for the bootstrap confidence interval the plotting data creation should be parallelized.

use_stored_data

Boolean specifying if the stored data within a model should be used. Raises an error if no stored data is available.

Value

Created figure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
# Example: Numeric
library(MASS)
neural_network <- NeuralNetwork(f = medv ~ ., data = Boston,
                                layers = c(5, 3), scale = TRUE,
                                linear.output = TRUE)

plot_partial_dependencies(neural_network, predictors = "crim",
                          probs = c(0.2, 0.8), type = "ggplotly")
plot_partial_dependencies(neural_network, predictors = c("crim", "age"))
plot_partial_dependencies(neural_network, probs = c(0.1, 0.9))

# Example: Categoric or Binary
library(datasets)
model <- NeuralNetwork(
   Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width,
   data = iris, layers = c(10, 10), rep = 5, err.fct = "ce",
   linear.output = FALSE, lifesign = "minimal", stepmax = 1000000,
   threshold = 0.001, scale = FALSE)

plot_partial_dependencies(model, predictors = "Petal.Length")
plot_partial_dependencies(model,
                          predictors = c("Sepal.Length", "Petal.Length"))
plot_partial_dependencies(model, type = "ggplotly")

## End(Not run)

AlexAfanasev/NeuralNetworkVisualization documentation built on Sept. 23, 2019, 2:29 a.m.