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

logsumexp has moved #2

Open
astromark opened this issue Mar 9, 2020 · 2 comments
Open

logsumexp has moved #2

astromark opened this issue Mar 9, 2020 · 2 comments

Comments

@astromark
Copy link

In the latest version of scipy, logsumexp has been moved scipy.misc to scipy.special.

There also seems to be some change in functionality as this line in bayan_sigma caused a ValueError: 'object arrays are not supported'
for coli in output_str_multimodel.columns.get_level_values(0): output_str[coli] = logsumexp(logweights_2d+output_str_multimodel[coli],axis=1)
I found that this could be prevented by adding [0] after logweights_2d, although I'm not sure if similar changes need to be made for other calls to logsumexp.

@Will-Cooper
Copy link

I also made the same change, additionally I found I had to ensure the arguments were a non-masked array as for some reason the code thought the data was masked (it had no reason to be though! and none of my input data was masked):

output_str[coli] = logsumexp((logweights_2d[0] + output_str_multimodel[coli]).filled(), axis=1)

@sylacour
Copy link

sylacour commented Jul 8, 2022

+1, I got the masked error:

site-packages/scipy/_lib/_util.py in _asarray_validated(a, check_finite, sparse_ok, objects_ok, mask_ok, as_inexact)
283 if not mask_ok:
284 if np.ma.isMaskedArray(a):
--> 285 raise ValueError('masked arrays are not supported')
286 toarray = np.asarray_chkfinite if check_finite else np.asarray
287 a = toarray(a)

ValueError: masked arrays are not supported

To make it work, I had to change the line 420 to (with the .data):
output_str[coli] = logsumexp(logweights_2d[0].data+output_str_multimodel[coli].values,axis=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