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