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

TypeError: cg() got multiple values for argument 'numItermax' #33

Open
Tako-liu opened this issue Aug 3, 2023 · 7 comments
Open

TypeError: cg() got multiple values for argument 'numItermax' #33

Tako-liu opened this issue Aug 3, 2023 · 7 comments

Comments

@Tako-liu
Copy link

Tako-liu commented Aug 3, 2023

Hello, great work!
I encountered the following error when running the sample data, does anyone know what the problem is?
I get an error when running this statement pi12 = pst.pairwise_align(slice1, slice2)
The error message is:
`Using selected backend cpu. If you want to use gpu, set use_gpu = True.

TypeError Traceback (most recent call last)
Input In [22], in <cell line: 1>()
----> 1 pi12 = pst.pairwise_align(slice1, slice2)

File ~/miniconda3/envs/st/lib/python3.8/site-packages/paste/PASTE.py:149, in pairwise_align(sliceA, sliceB, alpha, dissimilarity, use_rep, G_init, a_distribution, b_distribution, norm, numItermax, backend, use_gpu, return_obj, verbose, gpu_verbose, **kwargs)
147 if use_gpu:
148 G_init.cuda()
--> 149 pi, logw = my_fused_gromov_wasserstein(M, D_A, D_B, a, b, G_init = G_init, loss_fun='square_loss', alpha= alpha, log=True, numItermax=numItermax,verbose=verbose, use_gpu = use_gpu)
150 pi = nx.to_numpy(pi)
151 obj = nx.to_numpy(logw['fgw_dist'])

File ~/miniconda3/envs/st/lib/python3.8/site-packages/paste/PASTE.py:358, in my_fused_gromov_wasserstein(M, C1, C2, p, q, G_init, loss_fun, alpha, armijo, log, numItermax, tol_rel, tol_abs, use_gpu, **kwargs)
355 return solve_gromov_linesearch(G, deltaG, cost_G, C1, C2, M=0., reg=1., nx=nx, **kwargs)
357 if log:
--> 358 res, log = ot.optim.cg(p, q, (1 - alpha) * M, alpha, f, df, G0, line_search, log=True, numItermax=numItermax, stopThr=tol_rel, stopThr2=tol_abs, **kwargs)
360 fgw_dist = log['loss'][-1]
362 log['fgw_dist'] = fgw_dist

TypeError: cg() got multiple values for argument 'numItermax'`

@mrland99
Copy link
Member

mrland99 commented Aug 9, 2023

Hi,

What version of PASTE and POT are you using? I am unable to recreate the error. Are you using the newest version of PASTE?

Best,
Max

@Tako-liu
Copy link
Author

Hi! Thank you for your suggestion. I successfully ran the sample file, so I started working with my spatial transcriptome data. Since I only have one data point, I wanted to try doubling it by overlaying it on itself. However, after aligning, the coordinates for PASTE alignment are a bit mixed up. Is there a way to resolve this? Are there any parameters that can be adjusted?
image
image

@mrland99
Copy link
Member

Hi,

Sorry for the late response. When you doubled it by overlaying it on itself, did you change the copy at all? What are you trying to achieve by overlaying it on itself?

@Tako-liu
Copy link
Author

I apologize for the delayed response. I was trying to stack two different chips from the same organization, but they had slight differences in their structures. However, when I stacked the two chips together, I observed an opposite outcome. So, I attempted to stack the data from the same chip onto itself, but I still encountered the same situation. I don't understand what is happening and if there is any way for me to control this situation.

@zhangms1709
Copy link

zhangms1709 commented Mar 13, 2024

I get a similar issue when trying to run pairwise alignment. Is this an issue with the OT package? I was able to fix it by getting rid of the line_search input into ot.optim.cg() because I took a look at the code for the function and line_search is no longer a parameter for that function so it was mistaking it for numItermax.

@mrland99
Copy link
Member

mrland99 commented Mar 14, 2024

Ah that sounds like it could be the issue. There was a similar issue a while ago when POT updated their package previously. It is likely that could be the case. What version of POT did you end up using in your fix?

@zhangms1709
Copy link

I was able to fix it using POT-0.9.3 (I restored line_search as one of the parameters and it worked fine), I got the issue originally with POT-0.8.1.

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

3 participants