pyml.utils.metrics.euclidean_distance#
- euclidean_distance(x1, x2)[source]#
Computes the euclidean distance for two matrix-like objects :rtype:
ndarray
\[d(p,q)=\|q-p\|_{2}={\sqrt {(q_{1}-p_{1})^{2}+\cdots +(q_{n}-p_{n})^{2}}}={\sqrt {\sum _{i=1}^{n}(q_{i}-p_{i})^{2}}}\]- Parameters:
x1 (numpy.ndarray) – Input matrix
x2 (numpy.ndarray) – Input matrix The shapes of x1 and x2 must be compatible in terms of matching column number.
- Returns:
computed distance using the euclidean metric
- Return type:
numpy.ndarray