Repository navigation
Conversation
- src/embkit/align.py: Scale factor no longer least-squares - procrustes_scale() and procrustes_scale_centered() now calculated w/o least-squares (p correlation), now avoids shrinking toward the centroid under noisy anchor correspondence - procrustes_scale_centered() now delegates to procrustes_scale() - procrustes_scale() removed vector scaling, not optimized as intended - tests/preprocessing/test_align.py: Fix tests that were passing by coincidence after changes - testing for procrustes_scale() and procrustes_scale_centered(): now assert k is scalar, so regression back to vector/per-dim behavior is caught.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
In calculating the optimal scalar for procrustes, solving using Least Squares shrinks toward the centroid whenever anchor correspondence is noisy. For our purposes, this ruins scaling by shrinking the transformed (source) embeddings from the optimal size. Changes scale to match the target's spread directly without this bias, at the cost of no longer being RMSD-optimal.
Changes:
procrustes_scale_centered()now delegates toprocrustes_scale()on pre-centered dataprocrustes_scale()andprocrustes_scale_centered()are scalar-only (not per-dim vector) going forward.Updated two
procrustes_scale()tests and oneprocrustes_scale_centered()test. They now assertk's shape explicitly.Notes:
This PR removes all scaling functions using the traditional, RMSD optimizing, LeastSquares approach. If it is desirable to keep this in the kit, for other alignment cases (perhaps optimizing reconstruction), I am happy to bring that functionality back.