banyan_sigma
banyan_sigma copied to clipboard
logsumexp has moved
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.
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)
+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)