diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plot_UOT_barycenter_1D.py | 4 | ||||
-rwxr-xr-x | examples/plot_gromov_barycenter.py | 9 | ||||
-rw-r--r-- | examples/plot_otda_color_images.py | 5 | ||||
-rw-r--r-- | examples/plot_otda_mapping_colors_images.py | 5 | ||||
-rwxr-xr-x | examples/plot_partial_wass_and_gromov.py | 2 |
5 files changed, 12 insertions, 13 deletions
diff --git a/examples/plot_UOT_barycenter_1D.py b/examples/plot_UOT_barycenter_1D.py index c8d9d3b..acb5892 100644 --- a/examples/plot_UOT_barycenter_1D.py +++ b/examples/plot_UOT_barycenter_1D.py @@ -77,7 +77,7 @@ bary_l2 = A.dot(weights) reg = 1e-3 alpha = 1. -bary_wass = ot.unbalanced.barycenter_unbalanced(A, M, reg, alpha, weights) +bary_wass = ot.unbalanced.barycenter_unbalanced(A, M, reg, alpha, weights=weights) pl.figure(2) pl.clf() @@ -111,7 +111,7 @@ for i in range(0, n_weight): weight = weight_list[i] weights = np.array([1 - weight, weight]) B_l2[:, i] = A.dot(weights) - B_wass[:, i] = ot.unbalanced.barycenter_unbalanced(A, M, reg, alpha, weights) + B_wass[:, i] = ot.unbalanced.barycenter_unbalanced(A, M, reg, alpha, weights=weights) # plot interpolation diff --git a/examples/plot_gromov_barycenter.py b/examples/plot_gromov_barycenter.py index 58fc51a..101c6c5 100755 --- a/examples/plot_gromov_barycenter.py +++ b/examples/plot_gromov_barycenter.py @@ -17,7 +17,6 @@ computation in POT. import numpy as np
import scipy as sp
-import scipy.ndimage as spi
import matplotlib.pylab as pl
from sklearn import manifold
from sklearn.decomposition import PCA
@@ -90,10 +89,10 @@ def im2mat(I): return I.reshape((I.shape[0] * I.shape[1], I.shape[2]))
-square = spi.imread('../data/square.png').astype(np.float64)[:, :, 2] / 256
-cross = spi.imread('../data/cross.png').astype(np.float64)[:, :, 2] / 256
-triangle = spi.imread('../data/triangle.png').astype(np.float64)[:, :, 2] / 256
-star = spi.imread('../data/star.png').astype(np.float64)[:, :, 2] / 256
+square = pl.imread('../data/square.png').astype(np.float64)[:, :, 2] / 256
+cross = pl.imread('../data/cross.png').astype(np.float64)[:, :, 2] / 256
+triangle = pl.imread('../data/triangle.png').astype(np.float64)[:, :, 2] / 256
+star = pl.imread('../data/star.png').astype(np.float64)[:, :, 2] / 256
shapes = [square, cross, triangle, star]
diff --git a/examples/plot_otda_color_images.py b/examples/plot_otda_color_images.py index 62383a2..d9cbd2b 100644 --- a/examples/plot_otda_color_images.py +++ b/examples/plot_otda_color_images.py @@ -18,7 +18,6 @@ SIAM Journal on Imaging Sciences, 7(3), 1853-1882. # License: MIT License import numpy as np -from scipy import ndimage import matplotlib.pylab as pl import ot @@ -45,8 +44,8 @@ def minmax(I): # ------------- # Loading images -I1 = ndimage.imread('../data/ocean_day.jpg').astype(np.float64) / 256 -I2 = ndimage.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256 +I1 = pl.imread('../data/ocean_day.jpg').astype(np.float64) / 256 +I2 = pl.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256 X1 = im2mat(I1) X2 = im2mat(I2) diff --git a/examples/plot_otda_mapping_colors_images.py b/examples/plot_otda_mapping_colors_images.py index a20eca8..bc9afba 100644 --- a/examples/plot_otda_mapping_colors_images.py +++ b/examples/plot_otda_mapping_colors_images.py @@ -22,7 +22,6 @@ estimation [8]. # License: MIT License import numpy as np -from scipy import ndimage import matplotlib.pylab as pl import ot @@ -48,8 +47,8 @@ def minmax(I): # ------------- # Loading images -I1 = ndimage.imread('../data/ocean_day.jpg').astype(np.float64) / 256 -I2 = ndimage.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256 +I1 = pl.imread('../data/ocean_day.jpg').astype(np.float64) / 256 +I2 = pl.imread('../data/ocean_sunset.jpg').astype(np.float64) / 256 X1 = im2mat(I1) diff --git a/examples/plot_partial_wass_and_gromov.py b/examples/plot_partial_wass_and_gromov.py index a5af441..9f95a70 100755 --- a/examples/plot_partial_wass_and_gromov.py +++ b/examples/plot_partial_wass_and_gromov.py @@ -11,6 +11,8 @@ distance computation in POT. # Author: Laetitia Chapel <laetitia.chapel@irisa.fr>
# License: MIT License
+# necessary for 3d plot even if not used
+from mpl_toolkits.mplot3d import Axes3D # noqa
import scipy as sp
import numpy as np
import matplotlib.pylab as pl
|