Skip to content

Commit 80461cd

Browse files
authored
[FIX] Change in scipy cdist API (#487)
* correct metric name in ot.dist * add info to release file * remove the metric in tets (nobody uses it and sevral verisons of scipy exist on different python) * remove the metric in tets (nobody uses it and sevral verisons of scipy exist on different python) * convert to float because ? * pep8 * disble exmaple for the momeent * try sonias idea * change version
1 parent 9076f02 commit 80461cd

File tree

6 files changed

+7
-4
lines changed

6 files changed

+7
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44
jobs:
55
build_docs:
66
docker:
7-
- image: cimg/python:3.9
7+
- image: cimg/python:3.10
88
resource_class: medium
99
steps:
1010
- checkout

RELEASES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- Make marginal parameters optional for (F)GW solvers in `._gw`, `._bregman` and `._semirelaxed` (PR #455)
1818

1919
#### Closed issues
20+
21+
- Fix change in scipy API for `cdist` (PR #487)
2022
- Fix circleci-redirector action and codecov (PR #460)
2123
- Fix issues with cuda for ot.binary_search_circle and with gradients for ot.sliced_wasserstein_sphere (PR #457)
2224
- Major documentation cleanup (PR #462, #467, #475)

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def __getattr__(cls, name):
357357
sphinx_gallery_conf = {
358358
'examples_dirs': ['../../examples', '../../examples/da'],
359359
'gallery_dirs': 'auto_examples',
360+
'filename_pattern': 'plot_(?!barycenter_fgw)',
360361
'nested_sections' : False,
361362
'backreferences_dir': 'gen_modules/backreferences',
362363
'inspect_global_variables' : True,

examples/gromov/plot_barycenter_fgw.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def graph_colors(nx_graph, vmin=0, vmax=7):
161161

162162
#%% We compute the barycenter using FGW. Structure matrices are computed using the shortest_path distance in the graph
163163
# Features distances are the euclidean distances
164-
Cs = [shortest_path(nx.adjacency_matrix(x)) for x in X0]
164+
Cs = [shortest_path(nx.adjacency_matrix(x, dtype=np.int_)) for x in X0]
165165
ps = [np.ones(len(x.nodes())) / len(x.nodes()) for x in X0]
166166
Ys = [np.array([v for (k, v) in nx.get_node_attributes(x, 'attr_name').items()]).reshape(-1, 1) for x in X0]
167167
lambdas = np.array([np.ones(len(Ys)) / len(Ys)]).ravel()

ot/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def dist(x1, x2=None, metric='sqeuclidean', p=2, w=None):
285285
'sqeuclidean' or 'euclidean' on all backends. On numpy the function also
286286
accepts from the scipy.spatial.distance.cdist function : 'braycurtis',
287287
'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice',
288-
'euclidean', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis',
288+
'euclidean', 'hamming', 'jaccard', 'kulczynski1', 'mahalanobis',
289289
'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean',
290290
'sokalmichener', 'sokalsneath', 'sqeuclidean', 'wminkowski', 'yule'.
291291
p : float, optional

test/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_dist():
187187
# tests that every metric runs correctly
188188
metrics_w = [
189189
'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice',
190-
'euclidean', 'hamming', 'jaccard', 'kulsinski',
190+
'euclidean', 'hamming', 'jaccard',
191191
'matching', 'minkowski', 'rogerstanimoto', 'russellrao',
192192
'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'
193193
] # those that support weights

0 commit comments

Comments
 (0)