Several SciPy functions are documented as taking a “condensed distance matrix as returned by scipy.spatial.distance.pdist“. Now, inspection shows that what pdist returns is the row-major 1D-array form of the upper off-diagonal part of the distance matrix. This is all well and good, and natural and obvious, but is it documented or defined anywhere? I’d rather not assume anything about a data structure that’ll suddenly change. (Granted, there isn’t a lot of things it could change to, but I guess one possibility would be to wrap the array in an object that allows matrix-like indexing.)
Several SciPy functions are documented as taking a condensed distance matrix as returned by
Share
Honestly, this is a better question for the scipy users or dev list, as it’s about future plans for scipy.
However, the structure is fairly rigorously documented in the docstrings for both
scipy.spatial.pdistand inscipy.spatial.squareform.E.g. for
pdist:Becuase of this, and the fact that so many other functions in
scipy.spatialexpect a distance matrix in this form, I’d seriously doubt it’s going to change without a number of depreciation warnings and announcements.Modules in
scipyitself (as opposed to scipy’sscikits) are fairly stable, and there’s a great deal of consideration put into backwards compatibility when changes are made (and because of this, there’s quite a bit of legacy “cruft” inscipy: e.g. the fact that the corescipymodule is just numpy with different defaults on a couple of functions.).