(x, y, sigma=_mock_ones)
return d, grad
r"""Euclidean distance standardised against a vector of standard
    deviations per coordinate with gradient.

    ..math::
        D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}}
r"""Euclidean distance standardised against a vector of standard
    deviations per coordinate with gradient.
r Euclidean distance standardised against a vector of standard deviations per coordinate with gradient .
def standardised_euclidean_grad(x, y, sigma=_mock_ones):
    r"""Euclidean distance standardised against a vector of standard
    deviations per coordinate with gradient.

    ..math::
        D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}}
    """
    result = 0.0
    for i in range(x.shape[0]):
        result += (x[i] - y[i]) ** 2 / sigma[i]
    d = np.sqrt(result)
    grad = (x - y) / (1e-6 + d * sigma)
    return d, grad
def standardised_euclidean_grad ( x , y , sigma = _mock_ones ) : result = 0.0 for i in range ( x . shape [ 0 ] ) : result += ( x [ i ] - y [ i ] ) ** 2 / sigma [ i ] d = np . sqrt ( result ) grad = ( x - y ) / ( 1e-6 + d * sigma ) return d , grad