I am trying to understand this paper by Chapelle and Li "An Empirical Evaluation of Thompson Sampling" (2011). In particular, I am failing to derive the equations in algorithm 3 (page 6). The first equation looks like an NLL of $p(x|w) \, p(w)$ where the latter is the prior shown in the second line of the algorithm; modulo the constant term that does not depend on $w$. The question is: what is the likelihood? Obviously, it is not the canonical cross-entropy with $y_j \in \{0, 1\}$ but almost the cross-entropy with $y_j \in \{-1, +1\}$?
Furthermore, I don't understand the update step for $q_j$ in the last line: I can derive something that comes close using the Laplace approximation, $$q_j \leftarrow -\frac{\partial^2}{\partial w_j^2} \ln p(x, w),$$ and discarding correlations... but it is not the same and there are still some $y_j$ and other terms floating around.
Can someone tell me, how to derive these equations?
Thanks a lot!