Finding log-likelihood in a restricted boltzmann machine
Assume you have v visible units, and h hidden units, and v < h.  The key idea is that once you've fixed all the values for each visible unit, the hidden units are independent. 
So you loop through all 2^v subsets of visible unit activations.  Then computing the likelihood for the RBM with this particular activated visible subset is tractable, because the hidden units are independent[1].  So then loop through each hidden unit, and add up the probability of it being on and off conditioned on your subset of visible units.  Then multiply out all of those summed on/off hidden probabilities to get the probability that particular subset of visible units.  Add up all subsets and you are done.
The problem is that this is exponential in v.  If v > h, just "transpose" your RBM, pretending the hidden are visible and vice versa.
[1] The hidden units can't influence each other, because you influence would have to go through the visible units (no h to h connections), but you've fixed the visible units.
I have been researching RBMs for a couple months, using Python along the way, and have read all your papers. I am having a problem, and I thought, what the hey? Why not go to the source? I thought I would at least take the chance you may have time to reply.
My question is regarding the Log-Likelihood in a Restricted Boltzmann Machine. I have read that finding the exact log-likelihood in all but very small models is intractable, hence the introduction of contrastive divergence, PCD, pseudo log-likelihood etc. My question is, how do you find the exact log-likelihood in even a small model? 
I have come across several definitions of this formula, and all seem to be different. In Tielemen’s 2008 paper “Training Restricted Boltzmann Machines using Approximations To the Likelihood Gradient”, he performs a log-likelihood version of the test to compare to the other types of approximations, but does not say the formula he used. The closest thing I can find is the probabilities using the energy function over the partition function, but I have not been able to code this, as I don’t completely understand the syntax.
In Bengio et al “Representation Learning: A Review and New Perspectives”, the equation for the log-likelihood is:
 sum_t=1 to T (log P(X^T, theta)) 
which is equal to sum_t=1 to T(log * sum_h in {0,1}^d_h(P(x^(t), h; theta))
 where T is training examples. This is (14) on page 11. 
The only problem is that none of the other variables are defined. I assume x is the training data instance, but what is the superscript (t)? I also assume theta are the latent variables h, W, v… But how do you translate this into code?
I guess what I’m asking is can you give me a code (Python, pseudo-code, or any language) algorithm for finding the log-likelihood of a given model so I can understand what the variables stand for? That way, in simple cases, I can find the exact log-likelihood and then compare them to my approximations to see how well my approximations really are.