Public Member Functions | Private Member Functions | Private Attributes
mbl_rbf_network Class Reference

A class to perform some of the functions of a Radial Basis Function Network. More...

#include <mbl_rbf_network.h>

List of all members.

Public Member Functions

 mbl_rbf_network ()
 Dflt ctor.
void build (const vcl_vector< vnl_vector< double > > &x, double s=-1)
 Build weights given examples x.
void build (const vnl_vector< double > *x, int n, double s=-1)
 Build weights given n examples x[0] to x[n-1].
bool sumToOne () const
 If true, then the returned weights sum to 1.0.
void setSumToOne (bool flag)
 Set flag. If false, calcWts returns raw weights.
const vcl_vector< vnl_vector
< double > > & 
x () const
 Array of training vectors x, supplied in last build().
void calcWts (vnl_vector< double > &w, const vnl_vector< double > &new_x)
 Compute weights for given new_x.
short version_no () const
 Version number for I/O.
vcl_string is_a () const
 Name of the class.
bool is_class (vcl_string const &s) const
 True if this is (or is derived from) class named s.
void print_summary (vcl_ostream &os) const
 Print class to os.
void b_write (vsl_b_ostream &bfs) const
 Save class to binary file stream.
void b_read (vsl_b_istream &bfs)
 Load class from binary file stream.

Private Member Functions

double distSqr (const vnl_vector< double > &x, const vnl_vector< double > &y) const
double rbf (double r2) const
double rbf (const vnl_vector< double > &x, const vnl_vector< double > &y)

Private Attributes

vcl_vector< vnl_vector< double > > x_
vnl_matrix< double > W_
double s2_
bool sum_to_one_
vnl_vector< double > v_
 workspace.

Detailed Description

A class to perform some of the functions of a Radial Basis Function Network.

This is a special case of a mixture model pdf, where the same (radially symmetric) pdf kernel is used at each node. The nodes are supplied by build(). calcWts(w,x) calculates the probabilities that x belongs to each node. Given a set of n training vectors, x_i (i=0..n-1), a set of internal weights are computed. Given a new vector, x, a vector of weights, w, are computed such that if x = x_i then w(i+1) = 1, w(j !=i+1) = 0 The sum of the weights should always be unity. If x is not equal to any training vector, the vector of weights varies smoothly. This is useful for interpolation purposes. It can also be used to define non-linear transformations between vector spaces. If Y is a matrix of n columns, each corresponding to a vector in a new space which corresponds to one of the original training vectors x_i, then a vector x can be mapped to Yw in the new space. (Note: y-space does not have to have the same dimension as x space). This class is equivalent to the basis of thin-plate spline warping.

I'm not sure if this is exactly an RBF network in the original definition. I'll check one day.

Definition at line 40 of file mbl_rbf_network.h.


Constructor & Destructor Documentation

mbl_rbf_network::mbl_rbf_network ( )

Dflt ctor.

Definition at line 38 of file mbl_rbf_network.cxx.


Member Function Documentation

void mbl_rbf_network::b_read ( vsl_b_istream bfs)

Load class from binary file stream.

Definition at line 233 of file mbl_rbf_network.cxx.

void mbl_rbf_network::b_write ( vsl_b_ostream bfs) const

Save class to binary file stream.

Definition at line 215 of file mbl_rbf_network.cxx.

void mbl_rbf_network::build ( const vcl_vector< vnl_vector< double > > &  x,
double  s = -1 
)

Build weights given examples x.

s gives the scaling to use in r2 * vcl_log(r2) r2 = distSqr/(s*s) If s<=0 then a suitable s is estimated from the data

Definition at line 46 of file mbl_rbf_network.cxx.

void mbl_rbf_network::build ( const vnl_vector< double > *  x,
int  n,
double  s = -1 
)

Build weights given n examples x[0] to x[n-1].

s gives the scaling to use in r2 * vcl_log(r2) r2 = distSqr/(s*s) If s<=0 then a suitable s is estimated from the data

Definition at line 55 of file mbl_rbf_network.cxx.

void mbl_rbf_network::calcWts ( vnl_vector< double > &  w,
const vnl_vector< double > &  new_x 
)

Compute weights for given new_x.

If new_x = x()(i) then w(i+1)==1, w(j!=i+1)==0 Otherwise w varies smoothly depending on distance of new_x from x()'s If sumToOne() then elements of w will sum to 1.0 otherwise they will sum to <=1.0, decreasing as new_x moves away from the training examples x().

Definition at line 133 of file mbl_rbf_network.cxx.

double mbl_rbf_network::distSqr ( const vnl_vector< double > &  x,
const vnl_vector< double > &  y 
) const [private]

Definition at line 98 of file mbl_rbf_network.cxx.

vcl_string mbl_rbf_network::is_a ( ) const

Name of the class.

Definition at line 185 of file mbl_rbf_network.cxx.

bool mbl_rbf_network::is_class ( vcl_string const &  s) const

True if this is (or is derived from) class named s.

Definition at line 194 of file mbl_rbf_network.cxx.

void mbl_rbf_network::print_summary ( vcl_ostream &  os) const

Print class to os.

Definition at line 204 of file mbl_rbf_network.cxx.

double mbl_rbf_network::rbf ( double  r2) const [inline, private]

Definition at line 52 of file mbl_rbf_network.h.

double mbl_rbf_network::rbf ( const vnl_vector< double > &  x,
const vnl_vector< double > &  y 
) [inline, private]

Definition at line 55 of file mbl_rbf_network.h.

void mbl_rbf_network::setSumToOne ( bool  flag)

Set flag. If false, calcWts returns raw weights.

Definition at line 120 of file mbl_rbf_network.cxx.

bool mbl_rbf_network::sumToOne ( ) const [inline]

If true, then the returned weights sum to 1.0.

Definition at line 74 of file mbl_rbf_network.h.

short mbl_rbf_network::version_no ( ) const

Version number for I/O.

Definition at line 176 of file mbl_rbf_network.cxx.

const vcl_vector<vnl_vector<double> >& mbl_rbf_network::x ( ) const [inline]

Array of training vectors x, supplied in last build().

Definition at line 80 of file mbl_rbf_network.h.


Member Data Documentation

double mbl_rbf_network::s2_ [private]

Definition at line 44 of file mbl_rbf_network.h.

Definition at line 46 of file mbl_rbf_network.h.

vnl_vector<double> mbl_rbf_network::v_ [private]

workspace.

Definition at line 49 of file mbl_rbf_network.h.

vnl_matrix<double> mbl_rbf_network::W_ [private]

Definition at line 43 of file mbl_rbf_network.h.

vcl_vector<vnl_vector<double> > mbl_rbf_network::x_ [private]

Definition at line 42 of file mbl_rbf_network.h.


The documentation for this class was generated from the following files: