Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hopfield Network [No hidden layer] #117

Open
JellePiepenbrock opened this issue Jul 4, 2018 · 1 comment
Open

Hopfield Network [No hidden layer] #117

JellePiepenbrock opened this issue Jul 4, 2018 · 1 comment

Comments

@JellePiepenbrock
Copy link

JellePiepenbrock commented Jul 4, 2018

Is it possible to use Paysage to make a classical Hopfield network, without hidden units? In the examples, there is a Hopfield Network for MNIST, but this has hidden units. In trying to remove it (either setting n_hidden to 0 or removing the hidden layer from the layer list), there are a number of errors, which could be either mostly related to the fact that the utils/plotting files in the examples assume there is a hidden layer.

@drckf
Copy link
Owner

drckf commented Jul 8, 2018

Every model in Paysage has at least one hidden layer.

As a result, there are two things to consider with regards to the Hopfield model.

  1. The equilibrium distribution obtained using a Bernoulli visible layer and a Gaussian hidden layer is the same as a classical Hopfield network.

This is easy to show by integrating out the hidden units to compute the energy of the visible units:

E(v) = - log p(v) 
     = - log(\int dh p(v, h))
     = C - \log(\int dh e^( \sum_i a_i v_i + \sum_{\mu} h_{\mu}^2/2 + \sum_{i \mu} W_{i \mu} v_i h_{\mu}) 
     = C - \sum_i a_i v_i + \sum_{\mu} \log( \int dh_{\mu} e^{ h_{\mu}^2/2 + \sum_i W_{i \mu} v_i h_{\mu})
     = C' - \sum_i a_i v_i - 1/2 * \sum_{ij} (\sum_{\mu} W_{i \mu} W_{j \mu} ) v_i v_j

The constant term isn't relevant for the probability, so this is the same as the classical Hopfield model.

  1. If we consider the dynamics of a classical Hopfield model to be single spin flips (i.e., Glauber updates), then the dynamical properties of the Bernoulli-Gaussian RBM (which is updated by block Gibbs sampling) will be very different.

TLDR: you can use Paysage to compute properties of the equilibrium distribution of a classical Hopfield model but you cannot use it to compute dynamical properties with single spin flips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants