Skip to content

Conversation

kilianFatras
Copy link
Contributor

@kilianFatras kilianFatras commented Aug 29, 2018

This PR fixes a bug in the SGD dual solver function. This function is part of the stochastic semi dual and dual solver framework. There is also a speed up of the function by removing one for loop.

@rflamary
Copy link
Collaborator

Hello @kilianFatras,

Thank you for the PR.

Please provide a description of what this PR is doing. If it corrects a bug, add a test (commented) that check that this bug will no reappear in the future.

If you have computational gain, an example of script with time before and after the PR would be nice also.

Copy link
Collaborator

@rflamary rflamary left a comment

Choose a reason for hiding this comment

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

Hello @kilianFatras,

here are a few small comments and things to change before the merge.

@@ -21,6 +21,8 @@

__all__=['emd', 'emd2', 'barycenter', 'free_support_barycenter', 'cvx']

__all__=['emd', 'emd2', 'barycenter', 'cvx']
Copy link
Collaborator

Choose a reason for hiding this comment

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

delete this line, free_support_barycenter is a new function that has to be imported

@@ -184,8 +185,34 @@ def test_dual_sgd_sinkhorn():

# check constratints
np.testing.assert_allclose(
zero, (G_sgd - G_sinkhorn).sum(1), atol=1e-02) # cf convergence sgd
zero, (G_sgd - G_sinkhorn).sum(1), atol=1e-04) # cf convergence sgd
Copy link
Collaborator

Choose a reason for hiding this comment

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

this test makes no sens since you should sum the absolute value to test if error and not just the difference:

    np.testing.assert_allclose(G_sgd.sum(1),G_sinkhorn.sum(1), atol=1e-02)

same for sum(0)

@kilianFatras kilianFatras force-pushed the stochastic_OT branch 2 times, most recently from 74c7f5d to 698c1aa Compare August 29, 2018 20:50
@rflamary rflamary merged commit da5d07b into PythonOT:master Aug 30, 2018
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