We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The entropic_partial_wasserstein function produces nan when eps is small.
import ot import torch import numpy as np def compute_OT(M, alpha, beta, epsilon): s1, s2 = M.shape[0], M.shape[1] assert s1 == s2 unif_vec = ot.unif(s1) a, b = unif_vec/beta, unif_vec pi_1_np = ot.partial.entropic_partial_wasserstein(a, b, M, m=alpha, reg=epsilon) print(f"Original: sum(pi) = {pi_1_np.sum():.4f}, alpha = {alpha:.4f}") beta = 0.35 alpha = 0.01 M_1 = torch.load('M_1.pt') print(f"M_1 norm = {np.linalg.norm(M_1):.2f}\n") epsilon = 10. compute_OT(M_1, alpha, beta, epsilon) epsilon = 0.1 compute_OT(M_1, alpha, beta, epsilon)
Original: sum(pi) = 0.0100, alpha = 0.0100 G:\Mycode\POT\ot\partial.py:698: RuntimeWarning: divide by zero encountered in divide np.multiply(K, m / np.sum(K), out=K) G:\Mycode\POT\ot\partial.py:698: RuntimeWarning: invalid value encountered in multiply np.multiply(K, m / np.sum(K), out=K) Warning: numerical errors at iteration 0 Original: sum(pi) = nan, alpha = 0.0100
When eps=0.1, the output is Nan.
pip
conda
Output of the following code snippet:
import platform; print(platform.platform()) import sys; print("Python", sys.version) import numpy; print("NumPy", numpy.__version__) import scipy; print("SciPy", scipy.__version__) import ot; print("POT", ot.__version__)
The text was updated successfully, but these errors were encountered:
I will create a pull request soon.
Sorry, something went wrong.
No branches or pull requests
Describe the bug
The entropic_partial_wasserstein function produces nan when eps is small.
To Reproduce
Output
When eps=0.1, the output is Nan.
Expected behavior
Environment (please complete the following information):
pip
,conda
): pipOutput of the following code snippet:
Additional context
The text was updated successfully, but these errors were encountered: