Note that there are some explanatory texts on larger screens.

plurals
  1. POThe Free energy approximation Equation in Restriction Boltzmann Machines
    primarykey
    data
    text
    <p>According <a href="http://deeplearning.net/tutorial/rbm.html?goback=.gmr_70219.gde_70219_member_104223473#equation-free_energy_grad" rel="nofollow">a deeplearning tutorial</a>:</p> <p>The free energy in python is</p> <pre><code>def free_energy(self, v_sample): ''' Function to compute the free energy ''' wx_b = T.dot(v_sample, self.W) + self.hbias vbias_term = T.dot(v_sample, self.vbias) hidden_term = T.sum(T.log(1 + T.exp(wx_b)), axis=1) return -hidden_term - vbias_term </code></pre> <p>I am not very good at python, basically it get product expert of each visible unit as vector wx_b, calculate exp and plus 1 , calculate log and sum it for the hidden term.</p> <p>Which I believe is a little different than free energy equation in the Learning Deep Architectures:</p> <p>FreeEnergy(x) = −b′x − ∑log∑e^hi(ci+Wix). </p> <p>Where: </p> <ul> <li><code>hi</code> is the unit <code>i</code> hidden layer, </li> <li><code>ci</code> is the <code>i</code> hidden bias in vector c. </li> </ul> <p>It calculates exp and sum, calculate log respect to the sum value. after all sum all the product expert based on the number of visible unit.</p> <p>The above equation is eq.5.21 from <a href="https://wiki.inf.ed.ac.uk/twiki/pub/CSTR/ListenSemester1201112/bengio2009_deep_ai.pdf" rel="nofollow">Learning Deep Architectures for AI (Yoshua Bengio)</a></p> <p>Below is my draft of java implementation vis_v is the visible layer sample, hid_v is the hidden layer unit sample.</p> <pre><code>private double freeEnergy(RealVector vis_v, RealVector hid_v){ RealVector wx_hb= W.preMultiply(vis_v).add(hBias); double vbias_term= vis_v.dotProduct(vBias); double sum_hidden_term = 0; for(int i=0;i&lt; wx_hb.getDimension();i++){ RealVector vis_expert = hid_v.mapMultiply(wx_hb.getEntry(i)); double hidden_term= StatUtils.sum(vis_expert.map(new Exp()).toArray()); sum_hidden_term+=Math.log(hidden_term); } return -sum_hidden_term-vbias_term; } </code></pre> <p>Is this some kind of approximation? I am trying to implement the same thing in java, but am getting confused over it. Thanks in advance for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload