Skip to content
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

Error with compute cost matrix when reproducing HDA #1

Open
chenmzh opened this issue Feb 24, 2022 · 1 comment
Open

Error with compute cost matrix when reproducing HDA #1

chenmzh opened this issue Feb 24, 2022 · 1 comment

Comments

@chenmzh
Copy link

chenmzh commented Feb 24, 2022

Dear Authors,

I am trying to run the HDA script on my own dataset. The error comes when I run this code:
M_lin = compute_cost_matrix(Ty,Sy_ss,v=100)
and compute_cost_matrix is defined as:

M=ot.dist(ys.reshape(-1,1),yt.reshape(-1,1),metric=comp_(v))
return M

Then it will report the following:

~/test/lib/python3.7/site-packages/ot/utils.py in dist(x1, x2, metric, p, w)
    226             raise NotImplementedError()
    227         else:
--> 228             if metric.endswith("minkowski"):
    229                 return cdist(x1, x2, metric=metric, p=p, w=w)
    230             return cdist(x1, x2, metric=metric, w=w)

AttributeError: 'function' object has no attribute 'endswith'

On my local computer I try to edit the utils.py to avoid this error, but I wonder if there is a way to solve that when wrote the script.

Thank you very much for your attention!

@tvayer
Copy link
Collaborator

tvayer commented Feb 24, 2022

Hello,

I think it is because your "comp_(v)" is a function and in our code it should be a string (the name of the metric as written in the documentation of the cdist function).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants