New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] decrease tolerance on forecast #1655
Conversation
dipy/reconst/forecast.py
Outdated
@@ -479,7 +480,7 @@ def lb_forecast(sh_order): | |||
diag_lb = np.zeros(n_c) | |||
counter = 0 | |||
for l in range(0, sh_order + 1, 2): | |||
for m in range(-l, l + 1): | |||
for _ in range(-l, l + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the following?
for _ in range(-l, l + 1): | |
for l in range(0, sh_order + 1, 2): | |
diag_lb[l//2] = (l * (l + 1)) ** 2 |
And get rid of the counter variable? Wouldn't that have the same effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think so, because in your case, we will not fill diag_lb
, it misses some iteration or another trick
Yes. This looks like a good solution to me, and fixes the test failure on my machine. |
Codecov Report
@@ Coverage Diff @@
## master #1655 +/- ##
=========================================
Coverage ? 87.31%
=========================================
Files ? 246
Lines ? 32613
Branches ? 3552
=========================================
Hits ? 28477
Misses ? 3275
Partials ? 861
Continue to review full report at Codecov.
|
counter += 1 | ||
stop = 2 * l + 1 + counter | ||
diag_lb[counter:stop] = (l * (l + 1)) ** 2 | ||
counter = stop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
I am +1 for merging this. Might be good for others to also take a look. |
Thanks @skoudoro. All PRs should rebase. |
The aim of this PR is to fix #1654 by decreasing the solver tolerance. At the moment, the current tolerance is 0.001, which I think is too high for getting any quality solutions.
As you can see here, cvxpy (and osqp) improved its solver. In fact, some unnecessary extra variables were introduced during the problem resolution. Below, the previous version verbose result:
here, you can see that
variables n = 249
is really strange because our input matrix, in this test, has a shape of (193, 28). It will make more sense to have 221 variables. This is what we get with the newcvxpy
release as you can see below.To me, this indicates that the 2 versions of cvxpy are solving a different problem. Fixing the tolerance issue may be a good starting point for our test to stop failing. Does it make sense @maurozucchelli @arokem @Garyfallidis ?