Open rafguns opened 3 years ago
I don't see it correctly, unfortunately... Closing.
Reinvestigate! Seems like this should be possible.
Specifically, we should be able to do
doc_probs = all_docs / all_docs.sum(axis=1, keepdims=True)
The fiddly bit then is that we need to draw the corresponding sample from all_docs
and doc_probs
.
Another possible optimization. Rather than calling rng.choice
many times, the size
parameter can be used to generate them all in one go: https://numpy.org/doc/stable/reference/random/generated/numpy.random.Generator.choice.html#numpy.random.Generator.choice
If I see it correctly, we could do it only once in
jsd_samples
.