| Library: | nn |
| See also: | rbftrain rbfpredict rbfsave rbfload rbfinfo rbftrain2 |
| Quantlet: | rbftest | |
| Description: | tests the given rbfnet network |
| Usage: | {netOut,AED,MSE} = rbftest(x,y,rbfnet) | |
| Input: | ||
| x | (n x p) matrix, predictor variables | |
| y | (n x q) matrix, response variables | |
| rbfnet | composed object (list), RBF network as computed by rbftrain or rbftrain2 | |
| Output: | ||
| netOut | (n x q) matrix, output of the rbfnet | |
| AED | (n x q) matrix, absolute error difference, i.e. abs(netOut - y) | |
| MSE | scalar, mean squared error | |
library("nn") ; load the library
; training set
randomize(2020)
n = 10
xt = normal(n,2)+#(-1,-1)' | normal(n,2)+#(+1,+1)'
yt =(matrix(n)-1)|matrix(n)
; build the RBF network
clusters = 2
learn = 0.1|0.2|0.1
epochs = 5|5
mMSE = 0.05
activ = 0
rbfnet = rbftrain(xt,yt,clusters,learn,epochs,mMSE,activ)
; testing set
randomize(1140)
x = normal(n,2)+#(-1,-1)' | normal(n,2)+#(+1,+1)'
; predict the output
y = rbfpredict(x,rbfnet,0,1)
sum((y > 0.5) != yt)
; test the predicted values
test = rbftest(x,y,rbfnet)
test.MSE
Contents of t [1,] " An 2 - 2 - 1 RBF-network" [2,] " training epochs: 5 - 5" [3,] " cluster's learning rates: 0.2000 - 0.1000" [4,] " output's learning rate: 0.1000" [5,] " minimum mean squared error: 0.050" [6,] " BINARY sigmoid activation function" [7,] " minimum MSE reached: 0.190974 " Contents of sum [1,] 1 Contents of MSE [1,] 0.0030565