Learn R Programming

neuralnet (version 1.1)

plot.nn: Plot method for neural networks

Description

plot.nn, a method for the plot generic. It is designed for an inspection of the weights for objects of class nn, typically produced by neuralnet.

Usage

## S3 method for class 'nn':
    plot.nn(x, rep = NULL, x.entry = NULL, x.out = NULL,
        radius = 0.15, arrow.length = 0.2, intercept = TRUE, 
        intercept.factor = 0.4, information = TRUE,
        information.pos = 0.1, col.entry.synapse = "black",
        col.entry = "black", col.hidden = "black",
        col.hidden.synapse = "black", col.out = "black",
        col.out.synapse = "black", col.intercept = "blue",
        fontsize = 12, dimension = 6, show.weights = TRUE,
        file = NULL, ...)

Arguments

x
an object of class nn
rep
repetition of the neural net. If rep="best", the repetition with the smallest error will be plotted. If not stated all repetitions will be plotted, each in a separate window.
x.entry
x-coordinate of the entry layer. Depends on the arrow.length in default.
x.out
x-coordinate of the output layer.
radius
radius of the neurons.
arrow.length
length of the entry and out arrows.
intercept
a logical value indicating whether to plot the intercept.
intercept.factor
x-position factor of the intercept. The closer the factor is to 0, the closer the intercept is to its left neuron.
information
a logical value indicating whether to add the error, steps and threshold to the plot.
information.pos
y-position of the information.
col.entry.synapse
color of the synapses leading to the input neurons.
col.entry
color of the input neurons.
col.hidden
color of the neurons in the hidden layer.
col.hidden.synapse
color of the weighted synapses.
col.out
color of the output neurons.
col.out.synapse
color of the synapses leading away from the output neurons.
col.intercept
color of the intercept.
fontsize
fontsize of the text.
dimension
size of the plot in inches.
show.weights
a logical value indicating whether to print the calculated weights above the synapses.
file
a character string naming the plot to write to. If not stated, the plot will not be saved.
...
arguments to be passed to methods, such as graphical parameters (see par).

See Also

neuralnet

Examples

Run this code
XOR <- c(0,1,1,0)
xor.data <- data.frame(expand.grid(c(0,1), c(0,1)), XOR)
print(net.xor <- neuralnet( XOR~Var1+Var2, xor.data, hidden=2, rep=5))
plot(net.xor, rep="best")

Run the code above in your browser using DataLab