Open selmanozleyen opened 3 years ago
Adding a mall value is classic and it will work in practice so but i agree that we do not handle this well ;).
I have to look into it but i'm sure we can find a numerically stable way to do this update (using logsumexp? ).
Hi, thanks for the respond. Btw I love the work of you guys, just wanted to say... Anyways considering this:
r = M[i, :] - beta
exp_beta = cp.exp(-r / reg) * b
khi = exp_beta / (cp.sum(exp_beta))
can't we write this instead:
softmax(log(b)*(-r / reg))
yes this equivalent but it comes with more complex computations (matrix product vs stabilized log+exp). We plan on implementing this one by default because it will indeed provide more numerical stability but note that it will not help with convergence speed if you have a small regularization term.
Description
The following output showed up when playing with the codes on the docs of the stochastic sub-module. I think the output of the following code snippet is clear enough to show where the problem is but I didn't want to put a PR request directly since I am really new to these topics.
To Reproduce
Below is the same code samples from the docs except n_source here is significantly higher.
Additional Context
Right now I use stochastic.py file on my own project seperately because of this problem. I added a small value on the divisions and it seems to work fine but I am not sure if it is an appropiate aproach. For example:
Environment: