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 kwargs in PDHG #2010

Merged
merged 7 commits into from
Dec 13, 2024
Merged

Fix kwargs in PDHG #2010

merged 7 commits into from
Dec 13, 2024

Conversation

MargaretDuff
Copy link
Member

@MargaretDuff MargaretDuff commented Dec 11, 2024

Changes

  • check_convergence was a kwarg that, if passed, was then passed to the algorithm parent class which raised an error because it wasn't recognised
  • Similarly, you couldn't pass the theta kwarg because, if passed, it was then passed to the algorithm parent class which raised an error because it wasn't recognised

Discussed with Gemma and agreed to pop these kwargs before passing to the parent class

It is still open to me whether check_convergence should default to True or False. In the original issue, I claimed it should be False by default, but now I am not so sure. Mathematical convergence does not guarantee that it converges computationally in any reasonable time frame, and we know that we can get good (and sometimes quicker) solutions outside the mathematical convergence guarantees.

We decided to default to True to match with the docstring.

Testing you performed

Please add any demo scripts to https://github.com/TomographicImaging/CIL-Demos/tree/main/misc

Related issues/links

Closes #1965

Checklist

  • I have performed a self-review of my code
  • I have added docstrings in line with the guidance in the developer guide
  • I have updated the relevant documentation
  • I have implemented unit tests that cover any new or modified functionality
  • CHANGELOG.md has been updated with any functionality change
  • Request review from all relevant developers
  • Change pull request label to 'Waiting for review'

Contribution Notes

Please read and adhere to the developer guide and local patterns and conventions.

  • The content of this Pull Request (the Contribution) is intentionally submitted for inclusion in CIL (the Work) under the terms and conditions of the Apache-2.0 License
  • I confirm that the contribution does not violate any intellectual property rights of third parties

Copy link
Member

@lauramurgatroyd lauramurgatroyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like current master defaults to check_convergence being False (as you say it throws an error if its passed)? I would choose the default that preserves current behaviour rather than breaking backward compatability

Wrappers/Python/cil/optimisation/algorithms/PDHG.py Outdated Show resolved Hide resolved
@MargaretDuff MargaretDuff changed the title Remove kwargs from PDHG Remove kwargs that aren't popped from PDHG Dec 12, 2024
@MargaretDuff
Copy link
Member Author

Sounds like current master defaults to check_convergence being False (as you say it throws an error if its passed)? I would choose the default that preserves current behaviour rather than breaking backward compatability

The current approach runs it as default, but I think you can't turn it off as passing check_convergence=False leads to the error. To conserve backwards compatibility and to match the docstring, have left the default as True

Copy link
Member

@lauramurgatroyd lauramurgatroyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries if docs suggestions are out of scope - my main concern is the update_objective_interval

@MargaretDuff MargaretDuff changed the title Remove kwargs that aren't popped from PDHG Fix kwargs in PDHG Dec 13, 2024
Copy link
Member

@lauramurgatroyd lauramurgatroyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can confirm the todo is gone!

Let's go 🥳

Copy link
Member

@gfardell gfardell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

Wrappers/Python/cil/optimisation/algorithms/PDHG.py Outdated Show resolved Hide resolved
@MargaretDuff MargaretDuff merged commit 554a7fd into master Dec 13, 2024
11 checks passed
@MargaretDuff MargaretDuff deleted the check-convergence-in-pdhg branch December 13, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check convergence in PDHG throws an error, and should be False by default
3 participants