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

Refactor regularized TI costs #553

Merged
merged 17 commits into from
Jul 3, 2024
Merged

Refactor regularized TI costs #553

merged 17 commits into from
Jul 3, 2024

Conversation

michalk8
Copy link
Collaborator

No description provided.

Add new costs

Update tests

Final polishing
@michalk8 michalk8 self-assigned this Jun 27, 2024
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@michalk8 michalk8 added the enhancement New feature or request label Jun 27, 2024
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 97.93103% with 6 lines in your changes missing coverage. Please review.

Project coverage is 89.39%. Comparing base (c6fb25c) to head (e6afcf2).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #553      +/-   ##
==========================================
+ Coverage   89.09%   89.39%   +0.30%     
==========================================
  Files          70       71       +1     
  Lines        7427     7554     +127     
  Branches     1051     1080      +29     
==========================================
+ Hits         6617     6753     +136     
+ Misses        659      650       -9     
  Partials      151      151              
Files Coverage Δ
src/ott/geometry/costs.py 97.11% <94.91%> (+1.99%) ⬆️
src/ott/geometry/regularizers.py 98.70% <98.70%> (ø)

solver = solver.run(x, x=x)
sol = jax.lax.stop_gradient(solver.params)
return fun(sol, x)
x0 = x if x_init is None else x_init
Copy link
Collaborator Author

@michalk8 michalk8 Jul 1, 2024

Choose a reason for hiding this comment

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

I've changed the signature, now it will be possible to do:

cost_fn = ...
f = ...
x_inits = ...  # (k, d)

f_h = lambda x: jnp.min(jax.vmap(cost_fn.h_transform(f), in_axes=[None, 0])(x, x_inits)))

src/ott/geometry/costs.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@pkassraie pkassraie left a comment

Choose a reason for hiding this comment

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

I didn't check the test files, and I only checked the implementation of Regularization class and Quadratic (as requested).
Let more detailed comments on the code.

src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Outdated Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
src/ott/geometry/regularizers.py Show resolved Hide resolved
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!

src/ott/geometry/costs.py Outdated Show resolved Hide resolved
src/ott/geometry/costs.py Outdated Show resolved Hide resolved
src/ott/geometry/costs.py Show resolved Hide resolved
src/ott/geometry/costs.py Outdated Show resolved Hide resolved
src/ott/geometry/regularizers.py Outdated Show resolved Hide resolved
@michalk8 michalk8 merged commit d5d8a47 into main Jul 3, 2024
12 checks passed
@michalk8 michalk8 deleted the feature/refactor-reg-ti branch July 3, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants