Hi all, I have a problem with the predict command. Here is an example: from rpy import * r.library("nnet") model = r("Fxy~x+y")
df = r.data_frame(x = r.c(0,2,5,10,15) ,y = r.c(0,2,5,8,10) ,Fxy = r.c(0,2,5,8,10)) NNModel = r.nnet(model, data = df , size =10, decay =1e-3 , lineout=True, skip=True , maxit=1000, Hess =True) XG = r.expand_grid(x = r.seq(0,7,1), y = r.seq(0,7,1)) x = r.seq(0,7,1) y = r.seq(0,7,1) fit = r.predict(NNModel,XG) Running that skript delivers an error: Traceback (most recent call last): File "F:\test\Python\test.py", line 11, in <module> fit = r.predict(NNModel,XG) rpy.RPy_RException: Fehler in UseMethod("predict") : keine anwendbare Methode für "predict" But the same skript in R shows no problems. It seems that I got not the right way to speech to the predict function, but I can't see why. Here's the code in R: library(nnet) model <- Fxy~x+y df <- data.frame(x=c(0,2,5,10,15) ,y=c(0,2,5,8,10) ,Fxy=c(0,2,5,8,10)) NNModel <- nnet(model, data =df, size =10 , decay =1e-3, lineout=TRUE , skip=TRUE, maxit=1000, Hess =TRUE) XG <- expand.grid(x=seq(0,7,1),y=seq(0,7,1)) x <- seq(0,7,1) y <- seq(0,7,1) fit <- predict(NNModel,XG) which shows no problems. Where is the difference? I want to use the nnet Library to interpolate several 3D Datas. The python code loops over Data files and sorts them.. Maybe I have to put the whole code to R? I have to say that I don't complete understand the predict function- But in R does it what I want. I looked in the thread of Thomas few days ago, but it does not really help me. Thanks for any hints! Marco ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list