BUG: IndexError
when giving a zero distance matrix to multiscale_graphcorr
#19769
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.stats
Describe your issue.
Error
On calling
scipy.stats.multiscale_graphcorr
with either itsx
ory
parameter (as distance matrices, hence withcompute_distance=None
) contains only zero values, aIndexError
is raised.Investigation
Investigating the stack trace led me to the file
scipy/stats/_stats_py.py
lines 6471 to 6479*, where I see:*these lines number are taken from the version of the file on the repo as of now (ec98497)
It appears to me as a mismatch between the definition,
n, m = stat_mgc_map.shape
, and its use asstat_mgc_map[m - 1][n - 1]
, as it looks like that the arrays output by_local_correlations
are not necessarily square.However I cannot say I 100% understood how MGC works, hence I wonder if this is actually intended.
Context
For information, I got this error through via
hyppo
package, see this issue.Reproducing Code Example
Error message
SciPy/NumPy/Python version and system information
The text was updated successfully, but these errors were encountered: