<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/712" rel="nofollow">http://projects.scipy.org/scipy/ticket/712</a> on 2008-08-04 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jpaalasm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jpaalasm">@jpaalasm</a>, assigned to unknown.</em></p>
<p dir="auto">scipy.cluster.distance.pdist does not work when the Canberra distance is used.</p>
<p dir="auto">As seen below, pdist outputs a pseudorandom number instead of the real distance (which, in this case, should be around 0.01492537).</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [27]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[27]: array([ 0.99999814])

In [28]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[28]: array([ 0.9999984])

In [29]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[29]: array([ 1.])"><pre class="notranslate"><code class="notranslate">In [27]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[27]: array([ 0.99999814])

In [28]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[28]: array([ 0.9999984])

In [29]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[29]: array([ 1.])
</code></pre></div>
<p dir="auto">See the patch for a fix.</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/scipy/ticket/711" rel="nofollow">http://projects.scipy.org/scipy/ticket/711</a> on 2008-08-04 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jpaalasm/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jpaalasm">@jpaalasm</a>, assigned to trac user damian.eads.</em></p>
<p dir="auto">scipy.cluster.distance.pdist does not work when the Canberra distance is used.</p>
<p dir="auto">As seen below, pdist outputs a pseudorandom number instead of the real distance (which, in this case, should be around 0.01492537).</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [27]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[27]: array([ 0.99999814])

In [28]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[28]: array([ 0.9999984])

In [29]: scipy.cluster.distance.pdist(([3.3], [3.4]), &quot;canberra&quot;)
Out[29]: array([ 1.])"><pre class="notranslate"><code class="notranslate">In [27]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[27]: array([ 0.99999814])

In [28]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[28]: array([ 0.9999984])

In [29]: scipy.cluster.distance.pdist(([3.3], [3.4]), "canberra")
Out[29]: array([ 1.])
</code></pre></div>
<p dir="auto">See the patch for a fix.</p>