diff options
| author | ziejd2 | 2017-09-28 15:04:40 -0500 |
|---|---|---|
| committer | ziejd2 | 2017-09-28 15:04:40 -0500 |
| commit | 8070dc963753142bb86c4ed698d91fd623ed28e7 (patch) | |
| tree | d0f6dd8fc46a49b819aa55c1a90faa14d8448883 /sourcecodes/bnt-master/netlab3.3/rbffwd.m | |
| parent | 7cc31810d53176e805532b2789955f4eedbce6bb (diff) | |
| download | BNW-8070dc963753142bb86c4ed698d91fd623ed28e7.tar.gz | |
BNW using Octave instead of Matlab.
This version of BNW should perform the same as the original version. The only difference is that it uses Octave instead of Matlab when running BayesNet Toolbox during parameter learning. I am calling this BNW_1.02. It can be accessed at: compbio.uthsc.edu/BNW_1.02
Diffstat (limited to 'sourcecodes/bnt-master/netlab3.3/rbffwd.m')
| -rw-r--r-- | sourcecodes/bnt-master/netlab3.3/rbffwd.m | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/netlab3.3/rbffwd.m b/sourcecodes/bnt-master/netlab3.3/rbffwd.m new file mode 100644 index 00000000..af8a63e8 --- /dev/null +++ b/sourcecodes/bnt-master/netlab3.3/rbffwd.m @@ -0,0 +1,55 @@ +function [a, z, n2] = rbffwd(net, x) +%RBFFWD Forward propagation through RBF network with linear outputs. +% +% Description +% A = RBFFWD(NET, X) takes a network data structure NET and a matrix X +% of input vectors and forward propagates the inputs through the +% network to generate a matrix A of output vectors. Each row of X +% corresponds to one input vector and each row of A contains the +% corresponding output vector. The activation function that is used is +% determined by NET.ACTFN. +% +% [A, Z, N2] = RBFFWD(NET, X) also generates a matrix Z of the hidden +% unit activations where each row corresponds to one pattern. These +% hidden unit activations represent the design matrix for the RBF. The +% matrix N2 is the squared distances between each basis function centre +% and each pattern in which each row corresponds to a data point. +% +% See also +% RBF, RBFERR, RBFGRAD, RBFPAK, RBFTRAIN, RBFUNPAK +% + +% Copyright (c) Ian T Nabney (1996-2001) + +% Check arguments for consistency +errstring = consist(net, 'rbf', x); +if ~isempty(errstring); + error(errstring); +end + +[ndata, data_dim] = size(x); + +% Calculate squared norm matrix, of dimension (ndata, ncentres) +n2 = dist2(x, net.c); + +% Switch on activation function type +switch net.actfn + + case 'gaussian' % Gaussian + % Calculate width factors: net.wi contains squared widths + wi2 = ones(ndata, 1) * (2 .* net.wi); + + % Now compute the activations + z = exp(-(n2./wi2)); + + case 'tps' % Thin plate spline + z = n2.*log(n2+(n2==0)); + + case 'r4logr' % r^4 log r + z = n2.*n2.*log(n2+(n2==0)); + + otherwise + error('Unknown activation function in rbffwd') +end + +a = z*net.w2 + ones(ndata, 1)*net.b2; \ No newline at end of file |
