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