title: How to predict on test set in matrix factorization collaborative filtering
body: <p>Say I have df that looks like this</p>
  <pre><code>    userId     movieId    rating
  
  0     1           31         1
  1     1           34         5
  2     1           742        2
  3     1           1013       4
  4     2           31         1
     ...
  </code></pre>
  <p>I've splitted using stratified sampling to keep same user in both train/test set.</p>
  <p>When training on train dataset I would usually initialize embedding matrices for user and movies and try to learn using SGD.</p>
  <p>After two matrices learned say P, Q. I take dot_product(P_i, Q.T_j) to get prediction for (i,j)th position in rating's matrix.</p>
  <p>Since P,Q are learned embedding seems correct to use this learned embedding to predict validation dataset. However simply <code>validation_dataset - dot_product(P,Q)</code> doesn't make sense because shape of train and valid dataset are different.</p>
  <p>One way to do is from original dataset take-out known ratings and keep it as validation set. However I am wondering if there is a way to split data first then apply learned embeddings to predict test set (this seems more intuitive to me however do not know how to do it...)</p>