(x, y, w=_mock_ones, p=2)
return result ** (1.0 / p)
r"""A weighted version of Minkowski distance.

    ..math::
        D(x, y) = \left(\sum_i w_i |x_i - y_i|^p\right)^{\frac{1}{p}}

    If weights w_i are inverse standard deviations of data in each dimension
    then this represented a standardised Minkowski distance (and is
    equivalent to standardised Euclidean distance for p=1).
r"""A weighted version of Minkowski distance.
r A weighted version of Minkowski distance .
def weighted_minkowski(x, y, w=_mock_ones, p=2):
    r"""A weighted version of Minkowski distance.

    ..math::
        D(x, y) = \left(\sum_i w_i |x_i - y_i|^p\right)^{\frac{1}{p}}

    If weights w_i are inverse standard deviations of data in each dimension
    then this represented a standardised Minkowski distance (and is
    equivalent to standardised Euclidean distance for p=1).
    """
    result = 0.0
    for i in range(x.shape[0]):
        result += (w[i] * np.abs(x[i] - y[i])) ** p

    return result ** (1.0 / p)
def weighted_minkowski ( x , y , w = _mock_ones , p = 2 ) : result = 0.0 for i in range ( x . shape [ 0 ] ) : result += ( w [ i ] * np . abs ( x [ i ] - y [ i ] ) ) ** p return result ** ( 1.0 / p )