Skip to content
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 scaling bug in CG #45

Merged
merged 3 commits into from
Oct 18, 2021
Merged

Fix scaling bug in CG #45

merged 3 commits into from
Oct 18, 2021

Conversation

tbalke
Copy link
Contributor

@tbalke tbalke commented Oct 14, 2021

@bwohlberg @lukepfister
Kept the scale factor in the Hessian the same so that it truly is still the Hessian but removed the other scale factor.

@lukepfister
Copy link
Contributor

The ADMM quadratic tests are failing now. Can you look into that?

@tbalke
Copy link
Contributor Author

tbalke commented Oct 14, 2021

The ADMM quadratic tests are failing now. Can you look into that?

Interesting. It really is because of the change I made. (Assumed it was something else because it is just a scaler taken out.)

I'll look into it.

@tbalke
Copy link
Contributor Author

tbalke commented Oct 14, 2021

Amended the commit. Tests passing now.

Both the scale and the 2.0 factors needed to be removed.

@tbalke
Copy link
Contributor Author

tbalke commented Oct 14, 2021

I think it is ready for rebase and merge now.

@bwohlberg bwohlberg added the bug Something isn't working label Oct 15, 2021
@bwohlberg bwohlberg changed the title fixes scaling bug in cg from #38 Fix scaling bug in CG Oct 15, 2021
@bwohlberg
Copy link
Collaborator

Resolves #38

@bwohlberg
Copy link
Collaborator

Can we add a test that would catch the bug?

@lukepfister
Copy link
Contributor

lukepfister commented Oct 15, 2021 via email

@bwohlberg
Copy link
Collaborator

Change the loss scale to something like .3333 in the existing ADMM quadratic tests and that should do the trick

That doesn't do the trick, unfortunately. See branch brendt/admm-quadratic-test, which was made off the branch for this PR. The modified tests pass for GenericSubproblemSolver but they fail for LinearSubproblemSolver, so either (a) this PR doesn't resolve the problem, or (b) there's something wrong with the tests. If the tests and fix are correct, the tests involving GenericSubproblemSolver should fail for the main branch but pass in the branch for this PR.

@tbalke
Copy link
Contributor Author

tbalke commented Oct 16, 2021

See branch brendt/admm-quadratic-test, which was made off the branch for this PR

No, brendt/admm-quadratic-test branches of a different commit.

When using the fix from this PR most of the tests from brendt/admm-quadratic-test pass again, including the one with LinearSubproblemSolver. (Not all tests pass though)

scico/test/test_admm.py::TestReal::test_admm_generic PASSED                                                                                   [ 16%]
scico/test/test_admm.py::TestReal::test_admm_quadratic_scico PASSED                                                                           [ 33%]
scico/test/test_admm.py::TestReal::test_admm_quadratic_jax PASSED                                                                             [ 50%]
scico/test/test_admm.py::TestComplex::test_admm_generic FAILED                                                                                [ 66%]
scico/test/test_admm.py::TestComplex::test_admm_quadratic PASSED                                                                              [ 83%]
scico/test/test_admm.py::TestCircularConvolveSolve::test_admm PASSED                                                                          [100%]

@bwohlberg
Copy link
Collaborator

No, brendt/admm-quadratic-test branches of a different commit.

You're right, I branched it off the other tbalke/... branch by mistake.

When using the fix from this PR most of the tests from brendt/admm-quadratic-test pass again, including the one with LinearSubproblemSolver. (Not all tests pass though)

All tests pass for me now that I recreated my branch as a branch off of tbalke/cgfix.

scico/test/test_admm.py::TestComplex::test_admm_generic FAILED

Could you check the detailed log on this test? Perhaps it's failing because the accuracy tolerance is a bit too tight?

@bwohlberg bwohlberg mentioned this pull request Oct 16, 2021
@tbalke
Copy link
Contributor Author

tbalke commented Oct 16, 2021

All tests pass for me now that I recreated my branch as a branch off of tbalke/cgfix.

For me, too, all tests are passing now. Thanks!

@bwohlberg bwohlberg merged commit c844535 into main Oct 18, 2021
@bwohlberg bwohlberg deleted the tbalke/cgfix branch October 18, 2021 00:07
bwohlberg added a commit that referenced this pull request Oct 18, 2021
* Fixes scaling bug in CG from #38 (this commit already merged in PR #45)

* Tests solvers for loss.SquaredL2Loss with non-default scale factor

* Improve solution accuracy

* scale=pi, justify comment

Co-authored-by: Thilo Balke <thilo.balke@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants