{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The following are common calling conventions:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'euclidean')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the distance between "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " points using    Euclidean distance (2-norm) as the distance metric between the    points. The points are arranged as "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "    "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-dimensional row vectors in the matrix X."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'minkowski', p=2.)"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the distances using the Minkowski distance    "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\|u-v\\|_p"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " ("
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "p"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-norm) where "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "p > 0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (note    that this is only a quasi-metric if "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "0 < p < 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ")."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'cityblock')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the city block or Manhattan distance between the    points."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'seuclidean', V=None)"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the standardized Euclidean distance. The standardized    Euclidean distance between two n-vectors "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "\\sqrt{\\sum {(u_i-v_i)^2 / V[x_i]}}."
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "V is the variance vector; V[i] is the variance computed over all    the i'th components of the points. If not passed, it is    automatically computed."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'sqeuclidean')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the squared Euclidean distance "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\|u-v\\|_2^2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " between    the vectors."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'cosine')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the cosine distance between vectors u and v,"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "1 - \\frac{u \\cdot v}\n            {{\\|u\\|}_2 {\\|v\\|}_2}"
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "where "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\|*\\|_2"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the 2-norm of its argument "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "*"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and    "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "u \\cdot v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the dot product of "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'correlation')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the correlation distance between vectors u and v. This is"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "1 - \\frac{(u - \\bar{u}) \\cdot (v - \\bar{v})}\n            {{\\|(u - \\bar{u})\\|}_2 {\\|(v - \\bar{v})\\|}_2}"
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "where "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\bar{v}"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the mean of the elements of vector v,    and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "x \\cdot y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the dot product of "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'hamming')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the normalized Hamming distance, or the proportion of    those vector elements between two n-vectors "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "    which disagree. To save memory, the matrix "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "X"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be of type    boolean."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'jaccard')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Jaccard distance between the points. Given two    vectors, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the Jaccard distance is the    proportion of those elements "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u[i]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v[i]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " that    disagree where at least one of them is non-zero."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'jensenshannon')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Jensen-Shannon distance between two probability arrays.     Given two probability vectors, "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "p"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "q"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the     Jensen-Shannon distance is"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "\\sqrt{\\frac{D(p \\parallel m) + D(q \\parallel m)}{2}}"
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "where "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the pointwise mean of "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "p"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "q"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "     and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "D"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the Kullback-Leibler divergence."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'chebyshev')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Chebyshev distance between the points. The     Chebyshev distance between two n-vectors "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the     maximum norm-1 distance between their respective elements. More     precisely, the distance is given by"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "d(u,v) = \\max_i {|u_i-v_i|}."
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'canberra')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Canberra distance between the points. The     Canberra distance between two points "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "d(u,v) = \\sum_i \\frac{|u_i-v_i|}\n                         {|u_i|+|v_i|}."
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'braycurtis')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Bray-Curtis distance between the points. The     Bray-Curtis distance between two points "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "d(u,v) = \\frac{\\sum_i (|u_i-v_i|)}\n                  {\\sum_i (|u_i+v_i|)}"
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'mahalanobis', VI=None)"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Mahalanobis distance between the points. The     Mahalanobis distance between two points "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "u"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "v"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is     "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\sqrt{(u-v)(1/V)(u-v)^T}"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " where "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "(1/V)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "VI"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "     variable) is the inverse covariance. If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "VI"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not None,     "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "VI"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be used as the inverse covariance matrix."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'yule')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Yule distance between the boolean     vectors. (see "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "yule",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:yule"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " function documentation)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'matching')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Synonym for 'hamming'."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'dice')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Dice distance between the boolean vectors. (see     "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "dice",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:dice"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " function documentation)."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'rogerstanimoto')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Rogers-Tanimoto distance between the boolean     vectors. (see "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "rogerstanimoto",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:rogerstanimoto"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " function documentation)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'russellrao')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Russell-Rao distance between the boolean     vectors. (see "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "russellrao",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:russellrao"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " function documentation)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, 'sokalsneath')"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the Sokal-Sneath distance between the vectors. (see     "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "sokalsneath",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:sokalsneath"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " function documentation)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Y = cdist(XA, XB, f)"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Computes the distance between all pairs of vectors in X     using the user supplied 2-arity function f. For example,     Euclidean distance between the vectors could be computed     as follows        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "dm = cdist(XA, XB, lambda u, v: np.sqrt(((u-v)**2).sum()))",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Note that you should avoid passing a reference to one of     the distance functions defined in this library. For example,        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "dm = cdist(XA, XB, sokalsneath)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "would calculate the pair-wise distances between the vectors in     X using the Python function "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "sokalsneath",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.spatial.distance:sokalsneath"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This would result in     sokalsneath being called "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "{n \\choose 2}"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " times, which     is inefficient. Instead, the optimized C version is more     efficient, and we call it using the following syntax        "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "dm = cdist(XA, XB, 'sokalsneath')",
                  "execution_status": null
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "ValueError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An exception is thrown if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "XA"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "XB"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " do not have the same number of columns."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "Y",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_B"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " distance matrix is returned. For each "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "j"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the metric "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "dist(u=XA[i], v=XB[j])"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is computed and stored in the "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "ij"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " th entry."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute distance between each pair of the two collections of inputs."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "XA",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array of "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " original observations in an "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-dimensional space. Inputs are converted to float type."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "XB",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_B"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array of "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "m_B"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " original observations in an "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-dimensional space. Inputs are converted to float type."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "metric",
              "annotation": "str or callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The distance metric to use. If a string, the distance function can be 'braycurtis', 'canberra', 'chebyshev', 'cityblock', 'correlation', 'cosine', 'dice', 'euclidean', 'hamming', 'jaccard', 'jensenshannon', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalsneath', 'sqeuclidean', 'yule'."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "**kwargs",
              "annotation": "dict, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Extra arguments to "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "metric"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ": refer to each metric documentation for a list of all possible arguments."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Some possible arguments:"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "pscalar The p-norm to apply for Minkowski, weighted and unweighted. Default: 2."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "warray_like The weight vector for metrics that support weights (e.g., Minkowski)."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Varray_like The variance vector for standardized Euclidean. Default: var(vstack([XA, XB]), axis=0, ddof=1)"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "VIarray_like The inverse of the covariance matrix for Mahalanobis. Default: inv(cov(vstack([XA, XB].T))).T"
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "outndarray The output array If not None, the distance matrix Y is stored in this array."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "See Notes for common calling conventions."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/spatial/distance.py",
  "item_line": 2606,
  "item_type": "function",
  "aliases": [
    "scipy.cluster.vq.cdist"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Find the Euclidean distances between four 2-D coordinates:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.spatial import distance\nimport numpy as np\ncoords = [(35.0456, -85.2672),\n          (35.1174, -89.9711),\n          (35.9728, -83.9422),\n          (36.1667, -86.7833)]\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "distance.cdist(coords, coords, 'euclidean')\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nFind the Manhattan distance from a 3-D point to the corners of the unit\ncube:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "a = np.array([[0, 0, 0],\n              [0, 0, 1],\n              [0, 1, 0],\n              [0, 1, 1],\n              [1, 0, 0],\n              [1, 0, 1],\n              [1, 1, 0],\n              [1, 1, 1]])\nb = np.array([[ 0.1,  0.2,  0.4]])\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "distance.cdist(a, b, 'cityblock')\n",
        "execution_status": "failure"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "XA",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "XB",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "metric",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "euclidean"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "out",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "kwargs",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "VAR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "cdist"
  },
  "references": null,
  "qa": "scipy.spatial.distance:cdist",
  "arbitrary": [],
  "local_refs": [
    "**kwargs",
    "XA",
    "XB",
    "Y",
    "metric"
  ]
}