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/rbfsetbf.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/rbfsetbf.m')
| -rw-r--r-- | sourcecodes/bnt-master/netlab3.3/rbfsetbf.m | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/netlab3.3/rbfsetbf.m b/sourcecodes/bnt-master/netlab3.3/rbfsetbf.m new file mode 100644 index 00000000..9e8c3ca4 --- /dev/null +++ b/sourcecodes/bnt-master/netlab3.3/rbfsetbf.m @@ -0,0 +1,39 @@ +function net = rbfsetbf(net, options, x) +%RBFSETBF Set basis functions of RBF from data. +% +% Description +% NET = RBFSETBF(NET, OPTIONS, X) sets the basis functions of the RBF +% network NET so that they model the unconditional density of the +% dataset X. This is done by training a GMM with spherical covariances +% using GMMEM. The OPTIONS vector is passed to GMMEM. The widths of +% the functions are set by a call to RBFSETFW. +% +% See also +% RBFTRAIN, RBFSETFW, GMMEM +% + +% Copyright (c) Ian T Nabney (1996-2001) + +errstring = consist(net, 'rbf', x); +if ~isempty(errstring) + error(errstring); +end + +% Create a spherical Gaussian mixture model +mix = gmm(net.nin, net.nhidden, 'spherical'); + +% Initialise the parameters from the input data +% Just use a small number of k means iterations +kmoptions = zeros(1, 18); +kmoptions(1) = -1; % Turn off warnings +kmoptions(14) = 5; % Just 5 iterations to get centres roughly right +mix = gmminit(mix, x, kmoptions); + +% Train mixture model using EM algorithm +[mix, options] = gmmem(mix, x, options); + +% Now set the centres of the RBF from the centres of the mixture model +net.c = mix.centres; + +% options(7) gives scale of function widths +net = rbfsetfw(net, options(7)); \ No newline at end of file |
