comparison toolboxes/FullBNT-1.0.7/netlab3.3/rbfsetbf.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e9a9cd732c1e
1 function net = rbfsetbf(net, options, x)
2 %RBFSETBF Set basis functions of RBF from data.
3 %
4 % Description
5 % NET = RBFSETBF(NET, OPTIONS, X) sets the basis functions of the RBF
6 % network NET so that they model the unconditional density of the
7 % dataset X. This is done by training a GMM with spherical covariances
8 % using GMMEM. The OPTIONS vector is passed to GMMEM. The widths of
9 % the functions are set by a call to RBFSETFW.
10 %
11 % See also
12 % RBFTRAIN, RBFSETFW, GMMEM
13 %
14
15 % Copyright (c) Ian T Nabney (1996-2001)
16
17 errstring = consist(net, 'rbf', x);
18 if ~isempty(errstring)
19 error(errstring);
20 end
21
22 % Create a spherical Gaussian mixture model
23 mix = gmm(net.nin, net.nhidden, 'spherical');
24
25 % Initialise the parameters from the input data
26 % Just use a small number of k means iterations
27 kmoptions = zeros(1, 18);
28 kmoptions(1) = -1; % Turn off warnings
29 kmoptions(14) = 5; % Just 5 iterations to get centres roughly right
30 mix = gmminit(mix, x, kmoptions);
31
32 % Train mixture model using EM algorithm
33 [mix, options] = gmmem(mix, x, options);
34
35 % Now set the centres of the RBF from the centres of the mixture model
36 net.c = mix.centres;
37
38 % options(7) gives scale of function widths
39 net = rbfsetfw(net, options(7));