I’m using the neuralnet package in R, however am having problems saving the plot to disk.
data(iris)
attach(iris)
library(neuralnet)
nn <- neuralnet(as.numeric(Species) ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris)
png("test.png")
plot(nn)
dev.off()
Have attempted to refere to the manual, in the section plot.nn() it says:
file a character string naming the plot to write to. If not stated,
the plot will not be saved.
However doing the following yields no valid plot saved:
png("test.png")
plot(nn, file = "test.png")
dev.off()
Platform:
Mac OSX 10.7.3
R version:
platform x86_64-apple-darwin11.3.0
arch x86_64
os darwin11.3.0
system x86_64, darwin11.3.0
status
major 2
minor 15.1
year 2012
month 06
day 22
svn rev 59600
language R
version.string R version 2.15.1 (2012-06-22)
nickname Roasted Marshmallows
Note: R was installed via macports
After speaking with Frauke Guenther (Maintainer of
neuralnet), she explains the problem lies withneuralnet‘s ability to plot more than one neural net at the same time.The
plot(..., file = "")should have saved the file to disk, however does not seem to function properly, a fix will be patched soon to the package itself, however for the mean time she kindly provided a quickplot.nn()fix that would allow one to save the plot to disk.paste the code above into your R interactive prompt, and when you wish to to save your plot do the following: