-
Couldn't load subscription status.
- Fork 537
Pytest with 89% coverage #19
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
+632 −92
Merged
Changes from 1 commit
Commits
Show all changes
36 commits Select commit Hold shift + click to select a range
b2f91f2 full coveragre utils
rflamary c6e648f test parmap python 3.5
rflamary a31d3c2 map to list
rflamary f8e822c test sinkhorn with empty marginals
rflamary 7d9c5e7 add test optim
rflamary 709d8cb add dr tests
rflamary 83ecc6d bregman coverage
rflamary 64cf2fc tets barycenter
rflamary 33f3d30 clean pep8
rflamary bd705ed add test yunmlix and bary
rflamary f204e98 add test da 58% coverage
rflamary 5aad08a add test plot
rflamary a8d7301 add test plot and dataset
rflamary e11b1d1 test plot with no X
rflamary 11f0652 matplotlib travis
rflamary 46f297f import nmpy before ot
rflamary 68d7490 numpy assert + n_bins
rflamary 67b011a numpy assert test_da
rflamary 347e628 n to n_samples
rflamary 4a45135 dr +gpu numpy assert
rflamary 2bc41ad rng gpu
rflamary 6a02db0 test_optim
rflamary 86418eb test_optim allclose
rflamary 286de0a clean test_ot
rflamary 0e06129 Merge branch 'pytest' of github.com:rflamary/POT into pytest
rflamary 81118f2 test_ot random state
rflamary 109fc2a flake8
rflamary e0fa14b flake8
rflamary d101e08 nearly all review done
rflamary 77037cc gitignore
rflamary fac003d author and license for tets files
rflamary 0097017 add license and authors on all modules
rflamary 251af8e add author to all examples
rflamary 84aa318 pep8
rflamary 96f8b96 valid flake8
rflamary 838550e last stuff
rflamary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add test yunmlix and bary
- Loading branch information
commit bd705ed847dd7e43082e9d2771a59e539d6b7440
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -97,3 +97,37 @@ def test_bary(): | |
| bary_wass = ot.bregman.barycenter(A, M, reg, weights) | ||
| | ||
| assert np.allclose(1, np.sum(bary_wass)) | ||
| | ||
| ot.bregman.barycenter(A, M, reg, log=True, verbose=True) | ||
| | ||
| | ||
| def test_unmix(): | ||
| | ||
| n = 50 # nb bins | ||
| ||
| | ||
| # Gaussian distributions | ||
| a1 = ot.datasets.get_1D_gauss(n, m=20, s=10) # m= mean, s= std | ||
| a2 = ot.datasets.get_1D_gauss(n, m=40, s=10) | ||
| | ||
| a = ot.datasets.get_1D_gauss(n, m=30, s=10) | ||
| | ||
| # creating matrix A containing all distributions | ||
| D = np.vstack((a1, a2)).T | ||
| | ||
| # loss matrix + normalization | ||
| M = ot.utils.dist0(n) | ||
| M /= M.max() | ||
| | ||
| M0 = ot.utils.dist0(2) | ||
| M0 /= M0.max() | ||
| h0 = ot.unif(2) | ||
| | ||
| # wasserstein | ||
| reg = 1e-3 | ||
| um = ot.bregman.unmix(a, D, M, M0, h0, reg, 1, alpha=0.01,) | ||
| | ||
| assert np.allclose(1, np.sum(um), rtol=1e-03, atol=1e-03) | ||
| assert np.allclose([0.5, 0.5], um, rtol=1e-03, atol=1e-03) | ||
| | ||
| ot.bregman.unmix(a, D, M, M0, h0, reg, | ||
| 1, alpha=0.01, log=True, verbose=True) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have an assert_allclose function in numpy