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

Weighted Procrustes Analysis #1647

Merged
merged 2 commits into from
Aug 4, 2022
Merged

Conversation

tillns
Copy link

@tillns tillns commented Jul 28, 2022

I added an optional weight parameter to the procrustes() method in registration.py. It allows to compensate for a few noisy points to make the transformation more robust. Didn't have the time to adjust the test file, but I tested the method visually for myself. Idea to test:
Add some noise to a subset of the source points, which should increase the returned cost. Now weigh the points that noise was added to less depending on the intensity of the noise. While this will probably increase the average cost even further, it should decrease the cost for the remaining points. (Option that I didn't implement, but I'm not sure if it's good: Instead of returning average cost, return weighted average cost).

@mikedh mikedh changed the base branch from main to tune/vox August 3, 2022 19:16
@mikedh mikedh merged commit 5e098c6 into mikedh:tune/vox Aug 4, 2022
mikedh added a commit that referenced this pull request Aug 4, 2022
@mikedh
Copy link
Owner

mikedh commented Aug 4, 2022

Thanks for the PR! I added a quick test, and I noticed the np.diag(w).dot(...) was popping up on profiles as quite slow as it's making a large (n, n) matrix. I think I maintained the logic correctly as this appears to be just doing (stuff * w.reshape((-1, 1))

If I screwed up the logic let me know haha.

@tillns
Copy link
Author

tillns commented Aug 5, 2022

Thank you for this great open source project! Been using it a lot lately. That's a good catch by you. It shouldn't change the logic. I would only adjust the comment from lines 268 and 269 to not say w_mat anymore but w instead and maybe move it into the else clause.

mikedh added a commit that referenced this pull request Dec 3, 2024
Updated use of weights in procrustes analysis (update to #1647)
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.

2 participants