-
Notifications
You must be signed in to change notification settings - Fork 7
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
ValueError in corr estimation between mixed types #16
Comments
Hi, @Vlasovets , it seems that "t = np.column_stack((a, b, p))" should be "t = np.column_stack((a, b, c))". Isn't it? I assume you're talking about the latentcor_py. |
I'm sorry I see my bug... @Vlasovets Thank you very much for your test!!! I'll fix it ASAP! |
hi, @mingzehuang! |
Hi, @Vlasovets I think I've fixed the bug on both github version and PyPI. Let me know if anything need to further improved. Thank you for your test! |
hi, @mingzehuang! And seems to be connected to the length of the array to be 10.
Although, the error message now is different: File ~/kora/lib/python3.9/site-packages/latentcor/latentcor.py:502, in latentcor(X, tps, method, use_nearPD, nu, tol, ratio, showplot) File ~/kora/lib/python3.9/site-packages/latentcor/latentcor.py:252, in r_switch.r_approx(self, K, zratio1, zratio2, comb, tol, ratio) File ~/kora/lib/python3.9/site-packages/latentcor/latentcor.py:240, in r_switch.r_ml(self, K, zratio1, zratio2, comb) File ~/kora/lib/python3.9/site-packages/latentcor/latentcor.py:214, in r_switch.ipol_switch(self, comb, K, zratio1, zratio2) File ~/kora/lib/python3.9/site-packages/scipy/interpolate/_interpolate.py:2528, in RegularGridInterpolator.call(self, xi, method) ValueError: One of the requested xi is out of bounds in dimension 0` |
Hi, @Vlasovets, it works well on my computer. The output as follows: ordinal levels between 4 and 10 will be approximated by either countinuous or truncated type. I'm not sure where your problem come from but I'm looking at it trying to reproduce it:) |
I have created a collab, so you can test this bug independently from your working environment: |
Hi, @Vlasovets, |
Hi @Vlasovets, |
hi, @mingzehuang! thanks for taking a look at this!
So, when I run
And I do not get this warning when I run the same command in R, however, the results are different and it seems to be a convergence problem caused by the imbalance in the data, i.e., in some features there are only a small number of distinct values. You can recreate this bug by the same link:
Let me know if you need some clarification, I would be happy to help! |
Hi, @Vlasovets. |
Hi, @Vlasovets, I've used both latentcor in R and Python, the pointwise R (no positive definite correction) are consistent. So you can set "use_nearPD=False" if you don't need positive correction right now. I'm going to find some way to deal with the iteration limit of positive definite correction ASAP! |
@Vlasovets Also I just showed in your colab, the "method = approx" works as well :) |
Hi, @Vlasovets , I've made dictionary and increase the iteration limit of positive definite correction as well:) See the colab:) |
hi, @mingzehuang!
So, the problem seems to be from Colab side. Otherwise, the user might think that it works for any version by default.
There are a few things I have spotted:
I believe you should do
This can be easily fixed with Thank you for keep working on it, especially, for the dictionary in output, that made it much easier to use :) |
Hi, @Vlasovets |
hi, @mingzehuang! Hope you doing fine! I run it on a dataframe containing both microbial count table and respective covariates. array(['tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', 'tru', It seems to be correct the bacterial counts are truncated or binary (if bacterium appears only in one sample), and the last features are continuous covariates. However, if I would like to get a positive definite estimation ("approx" method), I face maximum iteration error. I've uploaded the .csv file with the data, so you can reproduce the error. Thank you for your time!
|
Hi!
I would like to use latentcorr in my project, but faced with the issue of addressing this block of the code which I cannot interpret.
You could recreate this issue with the following example:
`a = np.array([27.16, 68.78, 46.21, 39.4 , 20.86, 38.18, 33.16, 45.84, 29.36, 43.27])
b = np.array([32., 34., 32., 47., 31., 34., 34., 39., 36., 33.])
c = np.array([1., 2., 1., 2., 2., 2., 1., 2., 2., 1.])
t = np.column_stack((a, b, p))
latentcor(t, tps = get_tps(t, tru_prop=0.05))`
Error message
I've made multiple tests, and seems that this error arises when there are several continuous variables.
Would be great if you could explain why this is happening, thank you!
Oleg
The text was updated successfully, but these errors were encountered: