Open b4be1 opened 6 years ago
The problem seems to be in the mvn.logpdf
function. A simple hand-made implementation
def mvn_logpdf(X, mu, cov_sqrt):
return - 0.5 * np.log(np.linalg.det(2 * np.pi * cov_sqrt.T @ cov_sqrt)) \
- 0.5 * np.sum(((X - mu) @ np.linalg.inv(cov_sqrt))**2, axis=1)
gives the correct gradient and makes the optimization converge to a local optimum.
Thank you! It solved my problem too.
When I run gradient check in
examples/gmm.py
it fails. Optimization, as a consequence, also doesn't work. If I use
SLSQP
solver and let it compute gradients numerically, optimization proceeds in the right direction, so I suspect something might have changed in autograd, such that some operations do not get recorded for the backward pass.