Closed tariqdaouda closed 4 years ago
Thanks, Tariq! Sorry for the slow reply.
Could I ask if this simpler code might work for your data?
for label_category in labels.categories:
ix = indices[:,i]
q = labels[ix] == label_category
if np.any(q):
P_sum = np.sum(P[q])
simpson[i] += P_sum * P_sum
Also, do you think it'd be possible to generate a simple dataset and test the LISI code to confirm it won't break in this case?
q = np.squeeze(np.argwhere(labels[ix] == label_category))
Does not have a consistent behaviour, it could return either an iterable or a single element. In which case LISI computation breaks. This simple fix ensures a consistent behaviour.