Skip to content

SPDHG updates including to use the stochastic sampler - #1498

Closed
MargaretDuff wants to merge 115 commits into
TomographicImaging:masterfrom
MargaretDuff:stochastic_sampling
Closed

SPDHG updates including to use the stochastic sampler #1498
MargaretDuff wants to merge 115 commits into
TomographicImaging:masterfrom
MargaretDuff:stochastic_sampling

Conversation

@MargaretDuff

@MargaretDuff MargaretDuff commented Aug 15, 2023

Copy link
Copy Markdown
Member

Describe your changes

-Allow SPDHG to take a sampler either from our sampler class or any class with a next(self) function
-Deprecated prob from SPDHG, taking the probabilities instead from the sampler class or from a new argument prob_weights, choosing the default [1/num_subsets]*num_subsets if one is not provided in either place.
-Created two setters for the step sizes. set_step_sizes_from_ratio resets the step sizes if the user provides one/both/none of gamma and rho. step_sizes_custom takes in one/both/none of sigma and tau allowing the user to use a custom sigma and tau with those not provided calculated from the defaults. Calculating sigma from tau probably needs checking with someone else.
-Added a check_convergence function that checks self._sigma[i] * self._tau * self.norms[i]**2 <= self.prob_weights[i] for all i. This probably needs checking with someone else.
-Deprecated the kwarg "norms" to be replaced by the set_norms method in BlockOperator: added a function to return a list of norms and the ability to set this list of norms BlockOperator: added a function to return a list of norms and the ability to set this list of norms #1513.
-Unit tests for SPDHG setters and convergence check
-Speed up of current SPDHG unit tests.

Describe any testing you have performed

Please add any demo scripts to CIL-Demos/misc/
Test with SPDHG https://github.com/TomographicImaging/CIL-Demos/blob/main/misc/testing_sampling_SPDHG.ipynb

Similar results gained for all samplers for SPDHG, with 10 subsets
image

With 80 subsets:
image

Link relevant issues

Part of the stochastic work plan. Closes #1575. Closes #1576. Closes #1500. Closes #1496

Checklist when you are ready to request a review

  • I have performed a self-review of my code
  • I have added docstrings in line with the guidance in the developer guide
  • 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

@MargaretDuff

Copy link
Copy Markdown
Member Author

For discussion with @epapoutsellis, @jakobsj and @gfardell on 17/08/2023.

@MargaretDuff
MargaretDuff marked this pull request as ready for review September 25, 2023 14:52
@MargaretDuff MargaretDuff changed the title Stochastic sampling SPDHG updates and to use stochastic sampler Jan 9, 2024
@MargaretDuff
MargaretDuff marked this pull request as draft January 9, 2024 16:25
@MargaretDuff MargaretDuff changed the title SPDHG updates and to use stochastic sampler SPDHG updates including to use the stochastic sampler Jan 9, 2024
@MargaretDuff

Copy link
Copy Markdown
Member Author

Updated to include just updates to SPDHG:

  • Allow SPDHG to take a sampler either from our sampler class or any class with a next(self) function
  • Deprecated prob from SPDHG, taking the probabilities instead from the sampler class or from a new argument prob_weights, choosing the default [1/num_subsets]*num_subsets if one is not provided in either place.
    -Created two setters for the step sizes. set_step_sizes_from_ratio resets the step sizes if the user provides one/both/none of gamma and rho. step_sizes_custom takes in one/both/none of sigma and tau allowing the user to use a custom sigma and tau with those not provided calculated from the defaults. Calculating sigma from tau probably needs checking with someone else.
  • Added a check_convergence function that checks self._sigma[i] * self._tau * self.norms[i]**2 <= self.prob_weights[i] for all i. This probably needs checking with someone else.
    -Deprecated the kwarg "norms" to be replaced by the set_norms method in BlockOperator: added a function to return a list of norms and the ability to set this list of norms BlockOperator: added a function to return a list of norms and the ability to set this list of norms  #1513.
    -Unit tests for SPDHG setters and convergence check
    -Speed up of current SPDHG unit tests.

@MargaretDuff MargaretDuff mentioned this pull request Jan 9, 2024
8 tasks
@MargaretDuff

Copy link
Copy Markdown
Member Author

Replaced by #1644 and #1643

@MargaretDuff
MargaretDuff deleted the stochastic_sampling branch January 10, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

Allow SPDHG to choose the next function using different samplers Stochastic sampling methods Unittests for SPDHG take long time

4 participants