
To run an experiment:
ipython -pylab
>> import rnn_trbm.r.r_words as r

To sample from the network:
>> X = r.t.W.sample(T, G)
>> r.show_sample(X)
where T is the length of the sequence you wish to sample, while G is the number of gibbs steps you wish to do. 

To get a number that tells you how will the model is able to predict test data, type
>> import empirical_evaluation as e
>> e.empirically_evaluate(r.t) 
(this will output the mean squared error per pixel per timestep on a random test sequence)

In the paper, we reported
>> from scipy import mean
>> mean([e.empirically_evaluate(r.t) for i in range(500)]) 

To save a simulation:
>> r.t.save().
Next time you start it, it will be loaded automatically. (but be sure not to type r.init_good_VH() because the visibile-hidden connections will be erased).


================================================================

The structure of the code.

The code organized into several main packages.

The root of all packages is the directory rtrbm. 

In it there are the std, pylab.py, ff_net, trainers, and mio*.py, and mats.
These are not very relevant for our work. The package trainers
contains a class that takes care of doing the training / testing /
saving; it's general purpose. 

The package rbm implements simple Restricted Boltzmann Machine
gradients. It also implements exact gradients and log probabilities
(which is exponentially expensive in the size of the RBM) in order to
make sure that we've computed the correct gradients (the trainer class
imports a check_grad function; to see it, just type r.t.check_grad();
it is meaningless to do so for the rtrbm and the trbm in
general. However, if you modify the rnn_trbm class so that it uses the
exact gradients of the rbm, grad_check will become meaningful and will
give the correct answer).

The main action takes place in the package p8/rnn_trbm

In there, there are two classes: p8.rnn_trbm.rnn_trbm and
p8.rnn_trbm.trbm that implement the trbm and the rtrbm. Please have a
look at them. 

The class empirically_evaluation implements what it says: it tries to
get the (R)TRBM to predict the next timestep.


Finally, the package p8.rnn_trbm.r.r_balls and p8.rnn_trbm.r.r_mocap
implement the simulations themselves, and all the learning parameters
are defined there. 
