annotate toolboxes/FullBNT-1.0.7/netlab3.3/rbfsetbf.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function net = rbfsetbf(net, options, x)
Daniel@0 2 %RBFSETBF Set basis functions of RBF from data.
Daniel@0 3 %
Daniel@0 4 % Description
Daniel@0 5 % NET = RBFSETBF(NET, OPTIONS, X) sets the basis functions of the RBF
Daniel@0 6 % network NET so that they model the unconditional density of the
Daniel@0 7 % dataset X. This is done by training a GMM with spherical covariances
Daniel@0 8 % using GMMEM. The OPTIONS vector is passed to GMMEM. The widths of
Daniel@0 9 % the functions are set by a call to RBFSETFW.
Daniel@0 10 %
Daniel@0 11 % See also
Daniel@0 12 % RBFTRAIN, RBFSETFW, GMMEM
Daniel@0 13 %
Daniel@0 14
Daniel@0 15 % Copyright (c) Ian T Nabney (1996-2001)
Daniel@0 16
Daniel@0 17 errstring = consist(net, 'rbf', x);
Daniel@0 18 if ~isempty(errstring)
Daniel@0 19 error(errstring);
Daniel@0 20 end
Daniel@0 21
Daniel@0 22 % Create a spherical Gaussian mixture model
Daniel@0 23 mix = gmm(net.nin, net.nhidden, 'spherical');
Daniel@0 24
Daniel@0 25 % Initialise the parameters from the input data
Daniel@0 26 % Just use a small number of k means iterations
Daniel@0 27 kmoptions = zeros(1, 18);
Daniel@0 28 kmoptions(1) = -1; % Turn off warnings
Daniel@0 29 kmoptions(14) = 5; % Just 5 iterations to get centres roughly right
Daniel@0 30 mix = gmminit(mix, x, kmoptions);
Daniel@0 31
Daniel@0 32 % Train mixture model using EM algorithm
Daniel@0 33 [mix, options] = gmmem(mix, x, options);
Daniel@0 34
Daniel@0 35 % Now set the centres of the RBF from the centres of the mixture model
Daniel@0 36 net.c = mix.centres;
Daniel@0 37
Daniel@0 38 % options(7) gives scale of function widths
Daniel@0 39 net = rbfsetfw(net, options(7));