-2

I am trying to replicate this article https://arxiv.org/pdf/1606.07659v1.pdf in Keras. It uses auto-encoder as recommender systems. The idea is to mask some of the known values (ratings) in order to teach your network to predict the unknown values while reconstructing correctly the other values. You hence have three types of ratings: non-masked known values ,masked known values (become 0) and unknown values (become 0). Your loss function needs to include only the errors of the non-masked known values and masked known values but if I understand correctly you also need to mask the output for the unknown values for the back propagation to not include them in the weight update (and it needs to be case wise). The attached picture in the link (forward and back propagation) is from the article tutorial and explain the steps of forward and backpropagation.

Would you have any idea on how to implement this case wise masking of the output or any other way to deal with this problem?

Thanks a lot!

Cyrilleb
  • 1
  • 1

1 Answers1

0

If two tensor (A, Mask) is of same shape or can be broadcasted to same shape. Then use A*Mask to implement the element-wise masking.

A case wise masking can be implemented by K.switch() in the document. For example, K.switch(T.equal(Mask, 0), 0, A) return 0 if Mask is 0 else A element-wisely.

Van
  • 3,749
  • 1
  • 15
  • 15