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

[BUGFIX] Fix dense barycenter calculations #79

Merged
merged 12 commits into from
Oct 16, 2024

Conversation

pbarbarant
Copy link
Collaborator

Solves #58, #77 and #78.

Adds a new set of tests against POT and in the identity case. Fixes the barycenter weight mix-up issue in the dense case.
It might be worth opening another PR for the sparse case.

@pbarbarant pbarbarant changed the title [BUGFIX] Fix dense barycenter calculations. [BUGFIX] Fix dense barycenter calculations Oct 12, 2024
@@ -181,6 +183,9 @@ def fit(
have the same number of features n_features.
geometry_embedding (np.array or torch.Tensor): Common geometry
embedding of all individuals and barycenter.
subject_weights (list of float, optional): Weights of each individual.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naive question: is there really a usecase for this parameter ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly for interpolation:
https://pythonot.github.io/auto_examples/gromov/plot_gromov_barycenter.html

In our fMRI application, all subjects are assigned the same weight. However other FUGW users might do fancier things...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it since there is no immediate usecase where it could be relevant for the end user.

_,
_,
_,
) = fugw_barycenter.fit(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AN old traidiotn of sklearn is that fit() return the object itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to merge this PR first and open another one to fix this.

Copy link
Collaborator

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx.

@pbarbarant pbarbarant merged commit bede443 into alexisthual:main Oct 16, 2024
7 checks passed
@pbarbarant pbarbarant deleted the feat/test-edge-case-bary branch October 16, 2024 15:40
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