From 8070dc963753142bb86c4ed698d91fd623ed28e7 Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 28 Sep 2017 15:04:40 -0500 Subject: 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 --- sourcecodes/bnt-master/netlab3.3/rbffwd.m | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sourcecodes/bnt-master/netlab3.3/rbffwd.m (limited to 'sourcecodes/bnt-master/netlab3.3/rbffwd.m') 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 -- cgit 1.4.1