-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/tree recombination #504
Conversation
ad63ef9
to
752cae6
Compare
752cae6
to
442e88e
Compare
c8685dc
to
77072da
Compare
Additionally enhances coreset testing.
Adds a new `recombination.py` module to the solvers subpackage, providing a generalised `RecombinationSolver`, in addition to the `CaratheodoryRecombination` and `TreeRecombination` solvers. A `RecombinationSolverTest` case has been added to `test_solvers.py`, covering the known degenerate cases that may arise in recombination. The documentation has been updated where required, but no dedicated new examples/documentation pages have been created. Refs: #497
77072da
to
fbe7f2b
Compare
Will try review this next week! Just merged in a refactor of |
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.
Looks really good. Just some doc changes, various questions and additional comments would help me to be more confident the code is doing what the papers say
Apologies this took a while to get to, trying to wrap up work before leaving has taken more time than expected |
Performed in response to reviewer comments on #504
Adds references to the original articles for Tchakaloff's theorem and Caratheodory's convex hull theorem (in French/German respectively), in addition to more recent, but for our purposes equivalent, references written in English.
Makes clearer the correspondence between the Caratheodory recombination algorithm implemented here, and the thesis of Tchernychova. Provides additional clarity on the steps performed in Tree recombination.
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 am much much happier with my understanding of the code/maths with these additional comments, thanks for adding!
Remaining is some hopefully simple Pyright
fixes, and I think some of these private functions could live in util.py
, e.g. _resolve_rcond
, _prepare_tree
, _centroid
.
Also, what is your opinion on the private functions being added as static methods of the CaratheodoryRecombination
class. Are there any JAX implications?
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.
Also, some merge conflicts need fixing!
Corrects some simple to fix pyright linting errors.
In attempting to placate the pyright linter a new, erroneous change was made to the logic in `_resolve_null_basis`. This has been fixed and the type hints updated appropriately.
Apparent runtime incompatibility with jaxtyping. Appears that the `Shaped[TypeVar, ...]` syntax used for `_ElementOfOmega is not supported (even if the TypeVar is bound by Array).
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.
Looks good! Great feature
PR Type
Closes #497
Description
Provides
CaratheodoryRecombination
andTreeRecombination
solvers that are JIT compatible and avoid shape based recursion (instead using the jax for loop and while loop primitives to minimise the compilation time).While every effort has been made to be as computationally/memory efficient as possible, I suspect there remain many ways to enhance the performance/efficiency of the implementations. However, for now, I believe the performance level is sufficient for the solvers to be useful (we should seek further performance as and when user requirements demand it).
This pull also makes a small tweak to the
Coresubset
materialisation and testing, as these changes aided in checking the correctness of the recombination implementations.How Has This Been Tested?
Dedicated tests have been added, which check for most (maybe all) degenerate cases that can arise during recombination. To minimise the additional time costs incurred by testing recombination, no additional recombination specific integration tests/examples have been added.
Does this PR introduce a breaking change?
No
Checklist before requesting a review