Visualizing a neural network trained by neuralnet
The package, neuralnet
, provides the plot
function to visualize a built neural network and the gwplot
function to visualize generalized weights. In following recipe, we will cover how to use these two functions.
Getting ready
You need to have completed the previous recipe by training a neural network and have all the basic information saved in the network in order to complete this recipe.
How to do it...
Perform the following steps to visualize the neural network and the generalized weights:
- You can visualize the trained neural network with the
plot
function:
> plot(network)
The plot of the trained neural network
- Furthermore, you can use
gwplot
to visualize the generalized weights:
> par(mfrow=c(2,2)) > gwplot(network,selected.covariate="Petal.Width") > gwplot(network,selected.covariate="Sepal.Width") > gwplot(network,selected.covariate="Petal.Length") > gwplot(network,selected.covariate="Petal.Width"...