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