Description Usage Arguments Details Value Author(s) References See Also Examples
A function to plot the results of a neural network fit based on the plotnet()
function of the package NeuralNetTools
1 2 3 4 5 6 7 | ## 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, ...)
|
x |
A neural network fitted model |
nid |
logical value indicating if neural interpretation diagram is plotted, default is codeTRUE |
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 |
wts.only |
logical value indicating if connections weights are returned rather than a plot, default |
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 |
var.labs |
logical value indicating if variable names are plotted next to nodes, default |
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 |
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.
The function is producing a plot
Marcus W. Beck <mbafs2012@gmail.com> modified by Mikis Stasinopoulos
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
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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)
|
Loading required package: gamlss.dist
Loading required package: MASS
Loading required package: gamlss
Loading required package: splines
Loading required package: gamlss.data
Attaching package: 'gamlss.data'
The following object is masked from 'package:datasets':
sleep
Loading required package: nlme
Loading required package: parallel
********** GAMLSS Version 5.1-3 **********
For more on GAMLSS look at http://www.gamlss.org/
Type gamlssNews() to see new features/changes/bug fixes.
Loading required package: mgcv
This is mgcv 1.8-28. For overview type 'help("mgcv-package")'.
Loading required package: nnet
Attaching package: 'nnet'
The following object is masked from 'package:mgcv':
multinom
Loading required package: rpart
GAMLSS-RS iteration 1: Global Deviance = 27771.07
GAMLSS-RS iteration 2: Global Deviance = 27756.47
GAMLSS-RS iteration 3: Global Deviance = 27756.47
a 5-10-1 network with 71 weights
inputs: Fl A H1 loc2 loc3
output(s): y
options were - linear output units decay=0.2
GAMLSS-RS iteration 1: Global Deviance = 27575.54
GAMLSS-RS iteration 2: Global Deviance = 27508.11
GAMLSS-RS iteration 3: Global Deviance = 27492.5
GAMLSS-RS iteration 4: Global Deviance = 27491.17
GAMLSS-RS iteration 5: Global Deviance = 27491.17
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.