From 579fb3dd0395dc8035ad805c9d2b6be4471369ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 15:40:07 +0200 Subject: [PATCH 1/9] correct metric name in ot.dist --- ot/utils.py | 2 +- test/test_utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ot/utils.py b/ot/utils.py index 091b26813..1559eaaa6 100644 --- a/ot/utils.py +++ b/ot/utils.py @@ -285,7 +285,7 @@ def dist(x1, x2=None, metric='sqeuclidean', p=2, w=None): 'sqeuclidean' or 'euclidean' on all backends. On numpy the function also accepts from the scipy.spatial.distance.cdist function : 'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', - 'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', + 'euclidean', 'hamming', 'jaccard', 'kulczynski1', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', 'yule'. p : float, optional diff --git a/test/test_utils.py b/test/test_utils.py index 87f4dc48d..e5730c70b 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -187,7 +187,7 @@ def test_dist(): # tests that every metric runs correctly metrics_w = [ 'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', - 'euclidean', 'hamming', 'jaccard', 'kulsinski', + 'euclidean', 'hamming', 'jaccard', 'kulczynski1', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule' ] # those that support weights From 518c0a9b7bc05af032622079f12622e1c542e972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 15:49:11 +0200 Subject: [PATCH 2/9] add info to release file --- RELEASES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 2f47f4095..595fecfb5 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -17,6 +17,8 @@ - Make marginal parameters optional for (F)GW solvers in `._gw`, `._bregman` and `._semirelaxed` (PR #455) #### Closed issues + +- Fix change in scipy API for `cdist` (PR #487) - Fix circleci-redirector action and codecov (PR #460) - Fix issues with cuda for ot.binary_search_circle and with gradients for ot.sliced_wasserstein_sphere (PR #457) - Major documentation cleanup (PR #462, #467, #475) From 1fa58b83be33776a66c2138f69a07df7a2639fdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 15:55:15 +0200 Subject: [PATCH 3/9] remove the metric in tets (nobody uses it and sevral verisons of scipy exist on different python) --- test/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_utils.py b/test/test_utils.py index e5730c70b..a726a588c 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -187,7 +187,7 @@ def test_dist(): # tests that every metric runs correctly metrics_w = [ 'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', - 'euclidean', 'hamming', 'jaccard', 'kulczynski1', + 'euclidean', 'hamming', 'jaccard', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule' ] # those that support weights From 73b125eaedf0155e5c0b43828ba56127e9f76e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 16:22:17 +0200 Subject: [PATCH 4/9] remove the metric in tets (nobody uses it and sevral verisons of scipy exist on different python) --- examples/gromov/plot_barycenter_fgw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gromov/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py index 3b5db8b3b..4427004ff 100644 --- a/examples/gromov/plot_barycenter_fgw.py +++ b/examples/gromov/plot_barycenter_fgw.py @@ -161,7 +161,7 @@ def graph_colors(nx_graph, vmin=0, vmax=7): #%% We compute the barycenter using FGW. Structure matrices are computed using the shortest_path distance in the graph # Features distances are the euclidean distances -Cs = [shortest_path(nx.adjacency_matrix(x)) for x in X0] +Cs = [shortest_path(nx.adjacency_matrix(x, dtype=np.int64)) for x in X0] ps = [np.ones(len(x.nodes())) / len(x.nodes()) for x in X0] Ys = [np.array([v for (k, v) in nx.get_node_attributes(x, 'attr_name').items()]).reshape(-1, 1) for x in X0] lambdas = np.array([np.ones(len(Ys)) / len(Ys)]).ravel() From db04bb4807bdd0e6218ac069cc701fd260616947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 16:57:25 +0200 Subject: [PATCH 5/9] convert to float because ? --- examples/gromov/plot_barycenter_fgw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gromov/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py index 4427004ff..d0e37cada 100644 --- a/examples/gromov/plot_barycenter_fgw.py +++ b/examples/gromov/plot_barycenter_fgw.py @@ -161,7 +161,7 @@ def graph_colors(nx_graph, vmin=0, vmax=7): #%% We compute the barycenter using FGW. Structure matrices are computed using the shortest_path distance in the graph # Features distances are the euclidean distances -Cs = [shortest_path(nx.adjacency_matrix(x, dtype=np.int64)) for x in X0] +Cs = [shortest_path(nx.adjacency_matrix(x)*1.0) for x in X0] ps = [np.ones(len(x.nodes())) / len(x.nodes()) for x in X0] Ys = [np.array([v for (k, v) in nx.get_node_attributes(x, 'attr_name').items()]).reshape(-1, 1) for x in X0] lambdas = np.array([np.ones(len(Ys)) / len(Ys)]).ravel() From 54f7865255d8161d57c4c6456b0b8ce2c2f828f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Thu, 6 Jul 2023 17:07:47 +0200 Subject: [PATCH 6/9] pep8 --- examples/gromov/plot_barycenter_fgw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gromov/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py index d0e37cada..7ffea06a5 100644 --- a/examples/gromov/plot_barycenter_fgw.py +++ b/examples/gromov/plot_barycenter_fgw.py @@ -161,7 +161,7 @@ def graph_colors(nx_graph, vmin=0, vmax=7): #%% We compute the barycenter using FGW. Structure matrices are computed using the shortest_path distance in the graph # Features distances are the euclidean distances -Cs = [shortest_path(nx.adjacency_matrix(x)*1.0) for x in X0] +Cs = [shortest_path(nx.adjacency_matrix(x) * 1.0) for x in X0] ps = [np.ones(len(x.nodes())) / len(x.nodes()) for x in X0] Ys = [np.array([v for (k, v) in nx.get_node_attributes(x, 'attr_name').items()]).reshape(-1, 1) for x in X0] lambdas = np.array([np.ones(len(Ys)) / len(Ys)]).ravel() From 74b7bc5f38de2387ef1771385f4585d9320b4a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 7 Jul 2023 14:53:38 +0200 Subject: [PATCH 7/9] disble exmaple for the momeent --- docs/source/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/conf.py b/docs/source/conf.py index e88804bd6..2131a9d0b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -357,6 +357,7 @@ def __getattr__(cls, name): sphinx_gallery_conf = { 'examples_dirs': ['../../examples', '../../examples/da'], 'gallery_dirs': 'auto_examples', + 'filename_pattern': 'plot_(?!barycenter_fgw)', 'nested_sections' : False, 'backreferences_dir': 'gen_modules/backreferences', 'inspect_global_variables' : True, From d7943c34ce22d73da0df9a6a0fd24b52b8b89a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 7 Jul 2023 15:00:33 +0200 Subject: [PATCH 8/9] try sonias idea --- docs/source/conf.py | 2 +- examples/gromov/plot_barycenter_fgw.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2131a9d0b..f8857c7d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -357,7 +357,7 @@ def __getattr__(cls, name): sphinx_gallery_conf = { 'examples_dirs': ['../../examples', '../../examples/da'], 'gallery_dirs': 'auto_examples', - 'filename_pattern': 'plot_(?!barycenter_fgw)', + 'filename_pattern': 'plot_', 'nested_sections' : False, 'backreferences_dir': 'gen_modules/backreferences', 'inspect_global_variables' : True, diff --git a/examples/gromov/plot_barycenter_fgw.py b/examples/gromov/plot_barycenter_fgw.py index 7ffea06a5..40e5008c8 100644 --- a/examples/gromov/plot_barycenter_fgw.py +++ b/examples/gromov/plot_barycenter_fgw.py @@ -161,7 +161,7 @@ def graph_colors(nx_graph, vmin=0, vmax=7): #%% We compute the barycenter using FGW. Structure matrices are computed using the shortest_path distance in the graph # Features distances are the euclidean distances -Cs = [shortest_path(nx.adjacency_matrix(x) * 1.0) for x in X0] +Cs = [shortest_path(nx.adjacency_matrix(x, dtype=np.int_)) for x in X0] ps = [np.ones(len(x.nodes())) / len(x.nodes()) for x in X0] Ys = [np.array([v for (k, v) in nx.get_node_attributes(x, 'attr_name').items()]).reshape(-1, 1) for x in X0] lambdas = np.array([np.ones(len(Ys)) / len(Ys)]).ravel() From 6156ae5be2cfeb98966f3fd175ecf81245e11c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Flamary?= Date: Fri, 7 Jul 2023 15:19:36 +0200 Subject: [PATCH 9/9] change version --- .circleci/config.yml | 2 +- docs/source/conf.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d0e972cc2..00cd876cf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2 jobs: build_docs: docker: - - image: cimg/python:3.9 + - image: cimg/python:3.10 resource_class: medium steps: - checkout diff --git a/docs/source/conf.py b/docs/source/conf.py index f8857c7d2..2131a9d0b 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -357,7 +357,7 @@ def __getattr__(cls, name): sphinx_gallery_conf = { 'examples_dirs': ['../../examples', '../../examples/da'], 'gallery_dirs': 'auto_examples', - 'filename_pattern': 'plot_', + 'filename_pattern': 'plot_(?!barycenter_fgw)', 'nested_sections' : False, 'backreferences_dir': 'gen_modules/backreferences', 'inspect_global_variables' : True,