0

I am trying to replicate this standard example using Autograd package.

While I am able to replicate other examples from this repository, this particular example throws an error as follows:

    /home/avuis/anaconda/lib/python3.6/sitepackages/autograd/numpy/numpy_vjps.py:444: FutureWarning: 
Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. 
In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
      return lambda g: g[idxs]

Is this related version incompatibility? If so, any quick ways to fix this?

Thanks in advance,

Community
  • 1
  • 1
honeybadger
  • 1,465
  • 1
  • 19
  • 32
  • This is not an error you're receiving but a warning. Moreover, this warning should not affect your results in this moment but in later releases and I'm guessing it will be updated in the example you're trying to run. – Đorđe Relić Sep 12 '18 at 15:26
  • @ĐorđeRelić: Yeah, that was my first impression. But, unfortunately, the code does not go proceed to iteration 2 nor does it display any error. Will be thankful at least if someone can confirm they too have a similar issue. – honeybadger Sep 12 '18 at 21:33
  • 1
    I just cloned the repo and ran the example `gmm.py`. It ran for me without any errors nor warnings. However, it didn't produce any output either. Further googling the error you got got me to two issues (one for each of numpy and scipy repos). So what you might want to do is update your `scipy` package (I'm using version 1.0.0) and try again. For the numpy, autograd uses their version of numpy (`import autograd.numpy as np`) so I guess the issue is not there. – Đorđe Relić Sep 13 '18 at 12:41
  • @ĐorđeRelić: Thanks for confirming this issue. I think it should be fixed in their next update. Thanks again. – honeybadger Sep 13 '18 at 12:43
  • I'm going to write an answer as to try updating your `scipy` package to see if it deals with the issue. And also, by tweaking the code a bit I got a warning from `minimize` function stating "Warning: Desired error not necessarily achieved due to precision loss." so hence I don't have the output which should be "gmm.png". – Đorđe Relić Sep 13 '18 at 12:50
  • Just to confirm, the code runs without any errors but it does not produce any plots, or numbers, right? – honeybadger Sep 13 '18 at 12:56
  • yes. And my guess is that for this particular example both Hessian and Jacobian approximations are wrong. I came to this conclusion when I altered the code and used `‘L-BFGS-B` without jac and hess and I got an output. I'm going to add this to my answer. – Đorđe Relić Sep 13 '18 at 13:01
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/179997/discussion-between-dorde-relic-and-kasa). – Đorđe Relić Sep 13 '18 at 13:22

1 Answers1

1

Try updating your scipy package to a newer version. Version I'm using is 1.0.0 and the example works.

However, even with that change, this example doesn't work. It runs without errors but doesn't produce any results. My guess is that Hessian and Jacobian approximations are wrong and the minimization algorithm doesn't converge. If one tries with another minimization algorithm, it does converge (slowly but steadily). Current image in the repo that should represent the output is outdated since in the newest version of the code, number of classes in the pinwheel is 3 and not 5.

Đorđe Relić
  • 418
  • 4
  • 13