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

[FEAT] Add (Low-Rank) FUGW barycenters + brain tutorial #526

Open
wants to merge 60 commits into
base: main
Choose a base branch
from

Conversation

pbarbarant
Copy link

Completed with @S-bazaz for @marcocuturi 's 2024 Computational OT course at ENSAE.

Implements:

  • FUGW barycenters
  • Low-Rank support
  • Adapted/New tests
  • Short documentation-ready tutorial on brain surfaces

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

Attention: Patch coverage is 70.00000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 90.74%. Comparing base (261b730) to head (417c04a).
Report is 6 commits behind head on main.

Current head 417c04a differs from pull request most recent head f4fbb2e

Please upload reports for the commit f4fbb2e to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #526      +/-   ##
==========================================
- Coverage   90.93%   90.74%   -0.20%     
==========================================
  Files          68       68              
  Lines        7063     7088      +25     
  Branches      998     1004       +6     
==========================================
+ Hits         6423     6432       +9     
- Misses        486      502      +16     
  Partials      154      154              
Files Coverage Δ
src/ott/problems/quadratic/gw_barycenter.py 90.67% <100.00%> (+0.67%) ⬆️
src/ott/solvers/quadratic/gw_barycenter.py 81.53% <60.00%> (-7.85%) ⬇️

... and 3 files with indirect coverage changes

@michalk8 michalk8 added the project-2024 OT ENSAE 2024 label Jun 5, 2024
Copy link
Contributor

@marcocuturi marcocuturi left a comment

Choose a reason for hiding this comment

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

thanks a lot! will let @michalk8 have a look too!

scale_cost: Union[int, float, Literal["mean", "max_cost"]] = 1.0,
**kwargs: Any,
):
assert y is None or costs is None, "Cannot specify both `y` and `costs`."
) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

would remove None as this is an __init__ function

# y as costs
if problem._y_as_costs:
cost = problem._y[0, :, :]
# if not : initialized with euclidian metrics
Copy link
Contributor

Choose a reason for hiding this comment

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

Euclidean

# if not : initialized with euclidian metrics
else:
coords = problem._y[0, :, :]
pairwise_sq_dists = jnp.sum((coords[:, None] - coords[None]) ** 2,
Copy link
Contributor

Choose a reason for hiding this comment

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

would be more consistent to use a pointcloud.PointCloud geometry to compute this automatically, with, e.g., a cost_fn=Euclidean function. This may also avoid numerical issues with jnp.sqrt

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

Successfully merging this pull request may close these issues.

None yet

4 participants