rbf
index
/home/tilde/programming/SoC/scipy/Lib/sandbox/ann/rbf.py

# rbf2.py
# tilde
# 2006/08/20

 
Modules
       
numpy
random

 
Classes
       
rbf

 
class rbf
    Class to define/train/test a radial basis function network
 
  Methods defined here:
__init__(self, ni, no, f='linear')
Set up instance of RBF net. N.B. RBF centers and variance are selected at training time 
Input:
    ni  - <int> # of inputs
    no  - <int> # of outputs
    f   - <str> output activation fxn
err_fxn(self, w, X, Y)
Return vector of squared-errors for the leastsq optimizer
fwd_all(self, X, w=None)
Propagate values forward through the net.
Inputs:
        inputs      - vector of input values
        w           - packed array of weights
Returns:
        array of outputs for all input patterns
pack(self)
Compile weight matrices w,b from net into a
single vector, suitable for optimization routines.
test_all(self, X, Y)
Test network on an array (size>1) of patterns
Input:
    x   - array of input data
    t   - array of targets
Returns:
    sum-squared-error over all data
train(self, X, Y)
Train RBF network:
(i) select fixed centers randomly from input data (10%)
(ii) set fixed variance from max dist between centers
(iii) learn output weights using scipy's leastsq optimizer
unpack(self)
Decompose 1-d vector of weights w into appropriate weight
matrices (self.{w/b}) and reinsert them into net

 
Functions
       
main()
Build/train/test RBF net