wolffd@0: function net = rbfsetbf(net, options, x) wolffd@0: %RBFSETBF Set basis functions of RBF from data. wolffd@0: % wolffd@0: % Description wolffd@0: % NET = RBFSETBF(NET, OPTIONS, X) sets the basis functions of the RBF wolffd@0: % network NET so that they model the unconditional density of the wolffd@0: % dataset X. This is done by training a GMM with spherical covariances wolffd@0: % using GMMEM. The OPTIONS vector is passed to GMMEM. The widths of wolffd@0: % the functions are set by a call to RBFSETFW. wolffd@0: % wolffd@0: % See also wolffd@0: % RBFTRAIN, RBFSETFW, GMMEM wolffd@0: % wolffd@0: wolffd@0: % Copyright (c) Ian T Nabney (1996-2001) wolffd@0: wolffd@0: errstring = consist(net, 'rbf', x); wolffd@0: if ~isempty(errstring) wolffd@0: error(errstring); wolffd@0: end wolffd@0: wolffd@0: % Create a spherical Gaussian mixture model wolffd@0: mix = gmm(net.nin, net.nhidden, 'spherical'); wolffd@0: wolffd@0: % Initialise the parameters from the input data wolffd@0: % Just use a small number of k means iterations wolffd@0: kmoptions = zeros(1, 18); wolffd@0: kmoptions(1) = -1; % Turn off warnings wolffd@0: kmoptions(14) = 5; % Just 5 iterations to get centres roughly right wolffd@0: mix = gmminit(mix, x, kmoptions); wolffd@0: wolffd@0: % Train mixture model using EM algorithm wolffd@0: [mix, options] = gmmem(mix, x, options); wolffd@0: wolffd@0: % Now set the centres of the RBF from the centres of the mixture model wolffd@0: net.c = mix.centres; wolffd@0: wolffd@0: % options(7) gives scale of function widths wolffd@0: net = rbfsetfw(net, options(7));