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: correct refine behaviour on existing coreset #869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gw265981
Copy link
Contributor

PR Type

  • Bugfix

Description

Kernel Herding and Stein Thinning solvers implement a refine method which is meant to work with existing coresets. This functionality has been fixed so that starting with an existing coreset, each element is evaluated and potentially replaced according to the corresponding greedy rule.

How Has This Been Tested?

The results for KH coincide with an independent numpy implementation that maximises MMD at every step.

Does this PR introduce a breaking change?

No.

Checklist before requesting a review

  • I have made sure that my PR is not a duplicate.
  • My code follows the style guidelines of this project.
  • I have ensured my code is easy to understand, including docstrings and comments where necessary.
  • I have performed a self-review of my code.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.
  • I have updated CHANGELOG.md, if appropriate.

Copy link
Contributor

Performance review

Commit eca8d55 - Merge c0adcb1 into 98b6142

No significant changes to performance.

@gw265981 gw265981 linked an issue Nov 15, 2024 that may be closed by this pull request
@gw265981 gw265981 marked this pull request as ready for review November 15, 2024 12:47
@gw265981
Copy link
Contributor Author

There are two improvements that can be made here:

  1. Add analytic tests for refine for Kernel Herding and Stein Thinning.

  2. Investigate whether the behaviour is correct for Stein Thinning. This is difficult to check since Stein Thinning has many moving parts. One thing to consider is whether the current iteration i should be replaced by current coreset_size in the entropic regularisation term.

    ksd + laplace_correction - (i + 1) * regularised_log_pdf

If this fix is immediately useful (e.g., for #688), I'm happy for this to be merged now and work on the improvements afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KernelHerding.refine behaves incorrectly on an existing coreset
1 participant