plot.nnet {gamlss.add}R Documentation

Plotting fitted neural networks

Description

A function to plot the results of a neural network fit based on the plotnet() function of the package NeuralNetTools

Usage

## S3 method for class 'nnet'
## S3 method for class 'nnet'
plot(x, nid = TRUE, all.out = TRUE, all.in = TRUE, bias = TRUE, 
wts.only = FALSE, rel.rsc = 5, circle.cex = 5, node.labs = TRUE, 
var.labs = TRUE, x.lab = NULL, y.lab = NULL, line.stag = NULL, 
struct = NULL, cex.val = 1, alpha.val = 1, circle.col = "lightblue",
pos.col = "black", neg.col = "grey", max.sp = FALSE, ...)

Arguments

x

A neural network fitted model

nid

logical value indicating if neural interpretation diagram is plotted, default is TRUE

all.out

character string indicating names of response variables for which connections are plotted, default all

all.in

character string indicating names of input variables for which connections are plotted, default all

bias

logical value indicating if bias nodes and connections are plotted, not applicable for networks from mlp function, default TRUE

wts.only

logical value indicating if connections weights are returned rather than a plot, default FALSE

rel.rsc

numeric value indicating maximum width of connection lines, default 5

circle.cex

numeric value indicating size of nodes, passed to cex argument, default 5

node.labs

logical value indicating if text labels are plotted, default TRUE

var.labs

logical value indicating if variable names are plotted next to nodes, default TRUE

x.lab

character string indicating names for input variables, default from model object

y.lab

character string indicating names for output variables, default from model object

line.stag

numeric value that specifies distance of connection weights from nodes

struct

numeric value of length three indicating network architecture (no nodes for input, hidden, output), required only if mod.in is a numeric vector

cex.val

numeric value indicating size of text labels, default 1

alpha.val

numeric value (0-1) indicating transparency of connections, default 1

circle.col

text value indicating colour of nodes default "lighrblue"

pos.col

text value indicating colour of the possitive connections, default "black"

neg.col

text value indicating colour of the negative connections, default "gray"

max.sp

logical value indication whether the space betwwen nodes in each laers is maximised

...

for further arguments

Details

The function plot.nnet() is (almost) identical to the function plot.nnet() created by Marcus W. Beck it was first published in the web but now is part of the NeuralNetTools package in R under the name plotnet(). Here we modify the function it so it works within the gamlss.add package. This involves of borrowing the functions rescale(), zero_range() and alpha() from package scales.

Value

The function is producing a plot

Author(s)

Marcus W. Beck <mbafs2012@gmail.com> modified by Mikis Stasinopoulos

References

Marcus W. Beck (2015). NeuralNetTools: Visualization and Analysis Tools for Neural Networks. R package version 1.4.1. https://cran.r-project.org/package=NeuralNetTools

Hadley Wickham (2014). scales: Scale functions for graphics. R package version 0.4.0. https://cran.r-project.org/package=scales

See Also

nn

Examples

r1 <- gamlss(R~nn(~Fl+A+H+loc, size=10, decay=0.2), data=rent, 
      family=GA, gd.tol=1000, n.cyc=5)
getSmo(r1)
plot(getSmo(r1), y.lab=expression(eta[1]))
plot(getSmo(r1), y.lab=expression(g[1](mu)))
## Not run: 
r2 <- gamlss(R~nn(~Fl+A+H+loc, size=10, decay=0.2), 
      sigma.fo=~nn(~Fl+A+H+loc, size=10, decay=0.2),data=rent, 
      family=GA, gd.tol=1000, n.cyc=5)
plot(getSmo(r2), y.lab=expression(g[1](mu)))
plot(getSmo(r2, what="sigma"), y.lab=expression(g[2](sigma)))

## End(Not run)

[Package gamlss.add version 5.1-13 Index]