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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « scipy.spatial »

Fonction distance_matrix - module scipy.spatial

Signature de la fonction distance_matrix

def distance_matrix(x, y, p=2, threshold=1000000) 

Description

help(scipy.spatial.distance_matrix)

Compute the distance matrix.

Returns the matrix of all pair-wise distances.

Parameters
----------
x : (M, K) array_like
    Matrix of M vectors in K dimensions.
y : (N, K) array_like
    Matrix of N vectors in K dimensions.
p : float, 1 <= p <= infinity
    Which Minkowski p-norm to use.
threshold : positive int
    If ``M * N * K`` > `threshold`, algorithm uses a Python loop instead
    of large temporary arrays.

Returns
-------
result : (M, N) ndarray
    Matrix containing the distance from every vector in `x` to every vector
    in `y`.

Examples
--------
>>> from scipy.spatial import distance_matrix
>>> distance_matrix([[0,0],[0,1]], [[1,0],[1,1]])
array([[ 1.        ,  1.41421356],
       [ 1.41421356,  1.        ]])



Vous êtes un professionnel et vous avez besoin d'une formation ? Deep Learning avec Python
et Keras et Tensorflow
Voir le programme détaillé