comparison toolboxes/FullBNT-1.0.7/netlab3.3/mdnerr.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 e = mdnerr(net, x, t)
2 %MDNERR Evaluate error function for Mixture Density Network.
3 %
4 % Description
5 % E = MDNERR(NET, X, T) takes a mixture density network data structure
6 % NET, a matrix X of input vectors and a matrix T of target vectors,
7 % and evaluates the error function E. The error function is the
8 % negative log likelihood of the target data under the conditional
9 % density given by the mixture model parameterised by the MLP. Each
10 % row of X corresponds to one input vector and each row of T
11 % corresponds to one target vector.
12 %
13 % See also
14 % MDN, MDNFWD, MDNGRAD
15 %
16
17 % Copyright (c) Ian T Nabney (1996-2001)
18 % David J Evans (1998)
19
20 % Check arguments for consistency
21 errstring = consist(net, 'mdn', x, t);
22 if ~isempty(errstring)
23 error(errstring);
24 end
25
26 % Get the output mixture models
27 mixparams = mdnfwd(net, x);
28
29 % Compute the probabilities of mixtures
30 probs = mdnprob(mixparams, t);
31 % Compute the error
32 e = sum( -log(max(eps, sum(probs, 2))));
33