wolffd@0: function net = gtm(dim_latent, nlatent, dim_data, ncentres, rbfunc, ... wolffd@0: prior) wolffd@0: %GTM Create a Generative Topographic Map. wolffd@0: % wolffd@0: % Description wolffd@0: % wolffd@0: % NET = GTM(DIMLATENT, NLATENT, DIMDATA, NCENTRES, RBFUNC), takes the wolffd@0: % dimension of the latent space DIMLATENT, the number of data points wolffd@0: % sampled in the latent space NLATENT, the dimension of the data space wolffd@0: % DIMDATA, the number of centres in the RBF model NCENTRES, the wolffd@0: % activation function for the RBF RBFUNC and returns a data structure wolffd@0: % NET. The parameters in the RBF and GMM sub-models are set by calls to wolffd@0: % the corresponding creation routines RBF and GMM. wolffd@0: % wolffd@0: % The fields in NET are wolffd@0: % type = 'gtm' wolffd@0: % nin = dimension of data space wolffd@0: % dimlatent = dimension of latent space wolffd@0: % rbfnet = RBF network data structure wolffd@0: % gmmnet = GMM data structure wolffd@0: % X = sample of latent points wolffd@0: % wolffd@0: % NET = GTM(DIMLATENT, NLATENT, DIMDATA, NCENTRES, RBFUNC, PRIOR), wolffd@0: % sets a Gaussian zero mean prior on the parameters of the RBF model. wolffd@0: % PRIOR must be a scalar and represents the inverse variance of the wolffd@0: % prior distribution. This gives rise to a weight decay term in the wolffd@0: % error function. wolffd@0: % wolffd@0: % See also wolffd@0: % GTMFWD, GTMPOST, RBF, GMM wolffd@0: % wolffd@0: wolffd@0: % Copyright (c) Ian T Nabney (1996-2001) wolffd@0: wolffd@0: net.type = 'gtm'; wolffd@0: % Input to functions is data wolffd@0: net.nin = dim_data; wolffd@0: net.dim_latent = dim_latent; wolffd@0: wolffd@0: % Default is no regularisation wolffd@0: if nargin == 5 wolffd@0: prior = 0.0; wolffd@0: end wolffd@0: wolffd@0: % Only allow scalar prior wolffd@0: if isstruct(prior) | size(prior) ~= [1 1] wolffd@0: error('Prior must be a scalar'); wolffd@0: end wolffd@0: wolffd@0: % Create RBF network wolffd@0: net.rbfnet = rbf(dim_latent, ncentres, dim_data, rbfunc, ... wolffd@0: 'linear', prior); wolffd@0: wolffd@0: % Mask all but output weights wolffd@0: net.rbfnet.mask = rbfprior(rbfunc, dim_latent, ncentres, dim_data); wolffd@0: wolffd@0: % Create field for GMM output model wolffd@0: net.gmmnet = gmm(dim_data, nlatent, 'spherical'); wolffd@0: wolffd@0: % Create empty latent data sample wolffd@0: net.X = [];