[SciPy-Dev] error in docstring of pdist

Moritz Beber moritz.beber at gmail.com
Tue Jan 13 08:11:27 EST 2015


Hi Pierre,

On Tue, Jan 13, 2015 at 1:20 PM, Pierre Haessig <pierre.haessig at crans.org>
wrote:

> Hello,
>
> It's my first use of the distance function from scipy.spatial, and I
> wonder if there is an error in the docstring of pdist:
>
>
> http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.spatial.distance.pdist.html
> (same thing for cdist)
>
> [...]
> Returns
> -------
> Y : ndarray
>      Returns a condensed distance matrix Y.  For
>      each :math:`i` and :math:`j` (where :math:`i<j<n`), the
>      metric ``dist(u=X[i], v=X[j])`` is computed and stored in entry
> ``ij``.
> [...]
>
> Is this indeed the entry i*j ? Because the docstring of squareform says :
>

I don't think that i*j is meant here but rather the typical mathematical
matrix notation, in tex $X_{ij}$. I believe that you're right and this is
also incorrect, i.e., it should be something along the lines of what you
quote from the squareform documentation:


>
> [...]
> The  X[i, j] and X[j, i] values are set to  v[{n \choose 2}-{n-i \choose
> 2} + (j-u-1)]
> [...]
>

I do fail to see what `u` is in this context, however.


>
> best,
> Pierre
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>

So I think the docs should be improved. Care to submit a PR?

Cheers,
Moritz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20150113/12157f0f/attachment.html>


More information about the SciPy-Dev mailing list