ElleryL
(EL)
September 5, 2018, 7:09am
1
I couldn’t find through the documentations. I was looking for something similar to scipy.stats such that
from scipy.stats import multivariate_normal
mvn = multivariate_normal(np.zeros(2),np.identity(2))
mvn.pdf(np.array([[0,1],[1,0]]))
I can directly pass torch.Tensor object into scipy.stats but it only return numpy object and requires me to transform back.
richard
(Richard Zou)
September 5, 2018, 8:53pm
2
1 Like
It seems that it now disappeared ?
So to get dist.prob(x)
I am doing
dist.log_prob(x).exp()
Is that the best way ?
1 Like
log
is base 10 logarithm, you should use this:
10**dist.log_prob(x)
Thank you for your answer however I am pretty sure log_prob returns the natural logarithm.
For example you can see in the code for the uniform distribution that it uses torch.log() which is the natural logarithm.
4 Likes
Does this give similar results as scipy module?