Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « scipy.spatial.distance »

Fonction wminkowski - module scipy.spatial.distance

Signature de la fonction wminkowski

def wminkowski(u, v, p, w) 

Description

wminkowski.__doc__

    Compute the weighted Minkowski distance between two 1-D arrays.

    The weighted Minkowski distance between `u` and `v`, defined as

    .. math::

       \left(\sum{(|w_i (u_i - v_i)|^p)}\right)^{1/p}.

    Parameters
    ----------
    u : (N,) array_like
        Input array.
    v : (N,) array_like
        Input array.
    p : scalar
        The order of the norm of the difference :math:`{||u-v||}_p`.
    w : (N,) array_like
        The weight vector.

    Returns
    -------
    wminkowski : double
        The weighted Minkowski distance between vectors `u` and `v`.

    Notes
    -----
    `wminkowski` is deprecated and will be removed in SciPy 1.8.0.
    Use `minkowski` with the ``w`` argument instead.

    Examples
    --------
    >>> from scipy.spatial import distance
    >>> distance.wminkowski([1, 0, 0], [0, 1, 0], 1, np.ones(3))
    2.0
    >>> distance.wminkowski([1, 0, 0], [0, 1, 0], 2, np.ones(3))
    1.4142135623730951
    >>> distance.wminkowski([1, 0, 0], [0, 1, 0], 3, np.ones(3))
    1.2599210498948732
    >>> distance.wminkowski([1, 1, 0], [0, 1, 0], 1, np.ones(3))
    1.0
    >>> distance.wminkowski([1, 1, 0], [0, 1, 0], 2, np.ones(3))
    1.0
    >>> distance.wminkowski([1, 1, 0], [0, 1, 0], 3, np.ones(3))
    1.0