Hi all

I have a question about correct usage of persp(). I have a simple neural
net-based XOR example, as follows:

library(nnet)
xor.data <- data.frame(cbind(expand.grid(c(0,1),c(0,1)), c(0,1,1,0)))
names(xor.data) <- c("x","y","o")
xor.nn <- nnet(o ~ x + y, data=xor.data, linout=FALSE, size=1)

# Create an (x.y) surface and predict over all points
d <- data.frame(expand.grid(seq(0,1,.1), seq(0,1,.1)))
names(d) <- c("x","y")
p <- predict(xor.nn, d)
zmat <- as.matrix(cbind(d,p))

Now my z matrix consists of x and y points, and the corresponding prediction
value for each (x,y) tuple. What would be the best way to plot these? I
tried persp(), but it didnt like the z matrix. Is there an alternative plot
function that I could use (I am presuming I need one of the 3d variants)?
Thanks
Rory

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to