Skip to content

WIP: Feature: Wasserstein Barycenter Transport #296

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

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

Conversation

eddardd
Copy link

@eddardd eddardd commented Mar 9, 2025

Related to Issue #291

This PR adds the algorithm Wasserstein Barycenter Transport [29] to the SKADA benchmark. I also took the liberty of implementing a linearized version using affine OT mappings as proposed by [7]. Besides these 2 algorithms, I added 2 examples,

  • plot_joint_wasserstein_barycenter.py, which focuses exclusively on the computation of joint Wasserstein barycenters as in [38]
  • plot_multi_source_da, which compares the linearlized and empirical versions of WBT in the context of multi-source domain adaptation.

I also added references to two papers [38, 39], which are related to the computation of barycenters of Gaussian measures and feature-label joint empirical measures

Need for help

Before merging, I need to fix a few issues, notably concerning the documentation. I faced the following errors while running make html on skada/docs,

..\..\examples\plot_method_comparison.py unexpectedly failed to execute correctly:

    Traceback (most recent call last):
      File "C:\Users\eduar\Documents\repos\skada\examples\plot_method_comparison.py", line 193, in <module>
        clf.fit(X, y, sample_domain=sample_domain)
      File "C:\Users\eduar\.conda\envs\OptimalTransport\lib\site-packages\sklearn\base.py", line 1152, in wrapper
        return fit_method(estimator, *args, **kwargs)
      File "C:\Users\eduar\.conda\envs\OptimalTransport\lib\site-packages\sklearn\pipeline.py", line 422, in fit
        fit_params_steps = self._check_fit_params(**fit_params)
      File "C:\Users\eduar\.conda\envs\OptimalTransport\lib\site-packages\sklearn\pipeline.py", line 341, in _check_fit_params
        raise ValueError(
    ValueError: Pipeline.fit does not accept the sample_domain parameter. You can pass parameters to specific steps of your pipeline using the stepname__parameter format, e.g. `Pipeline.fit(X, y, logisticregression__sample_weight=sample_weight)`.

These errors were reproduced on nearly every instance where LogisticRegression is called with sample_domain.

References

[7] Flamary, R., Lounici, K., & Ferrari, A. (2019). Concentration bounds for linear monge mapping estimation and optimal transport domain adaptation. arXiv preprint arXiv:1905.10155.

[29] Montesuma, Eduardo Fernandes, and Fred Maurice Ngole Mboula. "Wasserstein barycenter for multi-source domain adaptation." In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 16785-16793. 2021.

[38] Álvarez-Esteban, Pedro C., et al. A fixed-point approach to barycenters in Wasserstein space. Journal of Mathematical Analysis and Applications 441.2 (2016): 744-762

[39] Montesuma, Eduardo, Fred Maurice Ngole Mboula, and Antoine Souloumiac. Multi-source domain adaptation through dataset dictionary learning in wasserstein space. ECAI 2023. IOS Press, 2023. 1739-1746.

@tgnassou
Copy link
Collaborator

tgnassou commented Mar 18, 2025

Hi @eddardd , I'm happy to see your PR! Let me know if you need help or anything. I can do a review whenever you want;)

@tgnassou
Copy link
Collaborator

For the CI, your new example multi_source_da misses docstrings at the beginning of the files. Look at the other examples if you need help.

I think you have some linter problem, did you use pre commit ?

And don't forget to add test for your new methods !

@rflamary
Copy link
Collaborator

@rflamary
Copy link
Collaborator

also the multi sourcer case with gaussian barycenter is already mplemented here:

class MultiLinearMongeAlignmentAdapter(BaseAdapter):

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.

4 participants