Mercurial > hg > camir-aes2014
comparison toolboxes/RBM/lowest_fenergy.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 L = lowest_fenergy(V,W,visB,hidB,Classes) | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % Return the labels L(Classes) to the lowest energy softmax unit % | |
4 % visP: hidden states % | |
5 % visN: reconstructed data (with softmax) % | |
6 % WW = [W visB hidB] % | |
7 % F(v) = -\sum_i v_ia_i - \sum_jlog(1+e^(x_j)) % | |
8 % -*-sontran2012-*- % | |
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
10 lNum = size(Classes,2); | |
11 sNum = size(V,1); | |
12 F = zeros(sNum,lNum); | |
13 out = zeros(sNum,lNum); | |
14 for i=1:lNum | |
15 F(:,i) = 1; | |
16 X = [V F]*W + repmat(hidB,sNum,1); | |
17 out(:,i) = sum(repmat(visB,sNum,1).*[V F],2) + sum(log(1+exp(X)),2); | |
18 F(:,i) = 0; | |
19 end | |
20 L = softmax2discrete(out,Classes); | |
21 end | |
22 |