Skip to content

Conversation

ngayraud
Copy link
Contributor

This PR is primarily adds the unbalanced sinkhorn method to the domain adaptation classes. When the other sinkhorn methods will be implemented (eg stabilized) they will also be supported by the parameter method, which will now raise an error according to what is in unbalanced.py

In addition:

  • a small bug in the unbalanced.py warnings is corrected.
  • Giving a norm value other than what is allowed and implemented will raise an error. I did that because I accidentally wrote something else and could not figure out where the bug was. Can be modified to raise a warning, but I think it should be an error.

…ll bug related to warnings in unbalaced.py . Added an error message when user wants to normalize with other than expected cost normalization functions.
@hichamjanati
Copy link
Contributor

Check these commits on my ongoing PR to fix travis
2566e97
8a9756d

Copy link
Contributor

@hichamjanati hichamjanati left a comment

Choose a reason for hiding this comment

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

Nice. The reg_e and reg_m are perhaps more adequate (than reg and alpha) with the naming convention of pot.
Can you please duplicate this test for your UnbalancedSinkhorn class ?

https://github.com/rflamary/POT/blob/b2157e9b3458388571f6ae87d80f47f500dfa166/test/test_da.py#L169


Parameters
----------
reg_e : float, optional (default=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps the default reg_e should be smaller ? or None and set to 10 / dimension for e.g in fit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but since by default norm = None, maybe we could leave it like that to avoid numerical errors in the default run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I just realized that I have to check if the norm is None and do no normalization in that case, otherwise the error message will be triggered...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok it is done and it seems ok

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok I just realized the other da classes use the same default

ot/da.py Outdated
"""

def __init__(self, reg_e=1., reg_m=0.1, method='sinkhorn',
max_iter=10, tol=10e-9, verbose=False, log=False,
Copy link
Contributor

Choose a reason for hiding this comment

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

this tol is 1e-8 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes. Actually the default value is 1e-9. Will fix.

@ngayraud
Copy link
Contributor Author

Shoot, there are still some syntax error and my flake8 and pydocstyle are buggy, I have to find a way to fix them

@ngayraud
Copy link
Contributor Author

Aaah finally. We are green.

@rflamary rflamary changed the title MRG: Adds Unbalaced transport to domain adaptation methods + bugfixes [MRG] Adds Unbalaced transport to domain adaptation methods + bugfixes Aug 15, 2019
@rflamary
Copy link
Collaborator

Thank you @ngayraud,

This PR looks very nice. I will have a quick look in the next days and will do the merge.

@rflamary rflamary merged commit abfe183 into PythonOT:master Aug 21, 2019
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.

3 participants