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

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