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