annotate toolboxes/FullBNT-1.0.7/netlab3.3/gtm.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function net = gtm(dim_latent, nlatent, dim_data, ncentres, rbfunc, ...
wolffd@0 2 prior)
wolffd@0 3 %GTM Create a Generative Topographic Map.
wolffd@0 4 %
wolffd@0 5 % Description
wolffd@0 6 %
wolffd@0 7 % NET = GTM(DIMLATENT, NLATENT, DIMDATA, NCENTRES, RBFUNC), takes the
wolffd@0 8 % dimension of the latent space DIMLATENT, the number of data points
wolffd@0 9 % sampled in the latent space NLATENT, the dimension of the data space
wolffd@0 10 % DIMDATA, the number of centres in the RBF model NCENTRES, the
wolffd@0 11 % activation function for the RBF RBFUNC and returns a data structure
wolffd@0 12 % NET. The parameters in the RBF and GMM sub-models are set by calls to
wolffd@0 13 % the corresponding creation routines RBF and GMM.
wolffd@0 14 %
wolffd@0 15 % The fields in NET are
wolffd@0 16 % type = 'gtm'
wolffd@0 17 % nin = dimension of data space
wolffd@0 18 % dimlatent = dimension of latent space
wolffd@0 19 % rbfnet = RBF network data structure
wolffd@0 20 % gmmnet = GMM data structure
wolffd@0 21 % X = sample of latent points
wolffd@0 22 %
wolffd@0 23 % NET = GTM(DIMLATENT, NLATENT, DIMDATA, NCENTRES, RBFUNC, PRIOR),
wolffd@0 24 % sets a Gaussian zero mean prior on the parameters of the RBF model.
wolffd@0 25 % PRIOR must be a scalar and represents the inverse variance of the
wolffd@0 26 % prior distribution. This gives rise to a weight decay term in the
wolffd@0 27 % error function.
wolffd@0 28 %
wolffd@0 29 % See also
wolffd@0 30 % GTMFWD, GTMPOST, RBF, GMM
wolffd@0 31 %
wolffd@0 32
wolffd@0 33 % Copyright (c) Ian T Nabney (1996-2001)
wolffd@0 34
wolffd@0 35 net.type = 'gtm';
wolffd@0 36 % Input to functions is data
wolffd@0 37 net.nin = dim_data;
wolffd@0 38 net.dim_latent = dim_latent;
wolffd@0 39
wolffd@0 40 % Default is no regularisation
wolffd@0 41 if nargin == 5
wolffd@0 42 prior = 0.0;
wolffd@0 43 end
wolffd@0 44
wolffd@0 45 % Only allow scalar prior
wolffd@0 46 if isstruct(prior) | size(prior) ~= [1 1]
wolffd@0 47 error('Prior must be a scalar');
wolffd@0 48 end
wolffd@0 49
wolffd@0 50 % Create RBF network
wolffd@0 51 net.rbfnet = rbf(dim_latent, ncentres, dim_data, rbfunc, ...
wolffd@0 52 'linear', prior);
wolffd@0 53
wolffd@0 54 % Mask all but output weights
wolffd@0 55 net.rbfnet.mask = rbfprior(rbfunc, dim_latent, ncentres, dim_data);
wolffd@0 56
wolffd@0 57 % Create field for GMM output model
wolffd@0 58 net.gmmnet = gmm(dim_data, nlatent, 'spherical');
wolffd@0 59
wolffd@0 60 % Create empty latent data sample
wolffd@0 61 net.X = [];