Restricted Boltzmann Machines (RBMs) were used in the Netflix competition to improve the prediction of user ratings for movies based on collaborative filtering.

I think I understand how to use RBMs as a generative model after obtaining the weights that maximize the likelihood of the data (in this case, of the visible units.) However, the Netflix competition had a very large number of missing ratings, so Salakhutdinov, Mnih and Hinton decided to use an RBM for each user with shared weights for users that rated the same movie. The training follows as usual, but I don't understand how to actually fill in missing entries of movies for a given user:

enter image description here

The paper linked above has a section titled "Making Predictions" in which the following equations are supposed to predict a rating for a new movie q:

$$p(v_{q}^{k}=1|V) \propto \sum_{h_1,...,h_p} \exp(-E(v_{q}^{k},V,h)) \\ \propto \Gamma_{q}^{k} \prod_{j=1}^{F}\sum_{h_J \in \{0,1\}}\exp(\sum_{il}v_{i}^{l}h_{j}W_{ij}^{l} + v_{q}^{k}h_{j}W_{qj}^{k}+h_jb_j)$$

This seems to be calculating the probability of an active visible unit with rating $k$ given the ratings $V$ of a single user. But I'm not sure how this helps to infer another movie that wasn't rated by a particular user and therefore, there are no units or weights available in the RBM for that user.

In this PDF (page 27), the author describes prediction based on the reconstruction phase:

$$\sum_k p(v_{i}^{k}=1, h)\times k$$ which is very different to the previous equation.


1 Answer 1


The input for missing movies are all zero.

In a vanilla RBM, once you go to the hidden layer and then come back to the visible layer, you'll get reconstructions for all movies, not just the ones that the current user have interacted with. In the training process it's really important to ignore those reconstructions so that they don't affect your weight matrix and visible layer bias in the update step. In this context, "ignore" means set the value to 0. If you don't set to 0 you'll get corrections in more weights than you really need.

On the other hand, to get predictions, you need use the full matrix to actually get all reconstructions.

As you pointed, you just calculate the activation for all visible units(using the softmax function), pick the five units related to some specific item and then apply the last formula which is the expected value for some movie $i$

$p_i = \sum_{k} p(v_{i}^{k} = 1 | h) k$

If your dataset contains natural numbers you can just round() them.

  • $\begingroup$ Hello! My working implementation of this model can be found here: github.com/felipecruz/CFRBM $\endgroup$ Commented Jul 3, 2016 at 2:31
  • $\begingroup$ @FelipeCruz I run your source code but got error (Anagonda in Window 10). Index out of range in "user_base.py", line 168, "experiments = read_experiment(sys.argv[1])". I changed to sys.argv[0], and got JSONDecodeError. Do you experience this error before? $\endgroup$ Commented Jul 14, 2016 at 20:06
  • $\begingroup$ Hello @Atena. You have to pass the first argument, which will be sys.argv[1] as a path to a json config file. Check this example config here: github.com/felipecruz/CFRBM/blob/master/ubased.json . If you still get erros, can you open an issue on github? thanks :) $\endgroup$ Commented Jul 15, 2016 at 0:13
  • $\begingroup$ @FelipeCruz Is the CF mentioned in the paper just user-based? It seems that the authors only consider users with similar tastes, but not similar movies? $\endgroup$
    – Munichong
    Commented Aug 22, 2016 at 21:24
  • $\begingroup$ @Munichong - Hello.. yes.. In the original paper they show how it works de CFRBM and another variation which is the conditional CFRBM but there are other articles that presents resulta for both U-RBM and I-RBM and one paper that uses a UI-RBM which is some king of combination between both. $\endgroup$ Commented Sep 7, 2016 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.