Sabra Ossen
Sabra Ossen

Reputation: 161

Predict using Radial Basis Function Neural Network in R

I am new to using radial basis function neural networks in R. The following is the code in the RSNNS CRAN package on how to use a rbf neural network, where the bottom half of the code is used to draw a graph of real values and the model.

inputs <- as.matrix(seq(0,10,0.1))
outputs <- as.matrix(sin(inputs) + runif(inputs*0.2))
outputs <- normalizeData(outputs, "0_1")
model <- rbf(inputs, outputs, size=40, maxit=1000,
initFuncParams=c(0, 1, 0, 0.01, 0.01),
learnFuncParams=c(1e-8, 0, 1e-8, 0.1, 0.8), linOut=TRUE)

par(mfrow=c(2,1))
plotIterativeError(model)
plot(inputs, outputs)
lines(inputs, fitted(model), col="green")

But I am unable to figure out how to use the model to predict values for a given test data set. How could this be done?

Upvotes: 1

Views: 3505

Answers (1)

Christoph Bergmeir
Christoph Bergmeir

Reputation: 111

you should use the predict() function. I.e., predict(model, testData)

Upvotes: 3

Related Questions