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 ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « scipy.spatial.distance »

Fonction is_valid_y - module scipy.spatial.distance

Signature de la fonction is_valid_y

def is_valid_y(y, warning=False, throw=False, name=None) 

Description

help(scipy.spatial.distance.is_valid_y)

Return True if the input array is a valid condensed distance matrix.

Condensed distance matrices must be 1-dimensional numpy arrays.
Their length must be a binomial coefficient :math:`{n \choose 2}`
for some positive integer n.

Parameters
----------
y : array_like
    The condensed distance matrix.
warning : bool, optional
    Invokes a warning if the variable passed is not a valid
    condensed distance matrix. The warning message explains why
    the distance matrix is not valid.  `name` is used when
    referencing the offending variable.
throw : bool, optional
    Throws an exception if the variable passed is not a valid
    condensed distance matrix.
name : bool, optional
    Used when referencing the offending variable in the
    warning or exception message.

Returns
-------
bool
    True if the input array is a valid condensed distance matrix,
    False otherwise.

Examples
--------
>>> from scipy.spatial.distance import is_valid_y

This vector is a valid condensed distance matrix.  The length is 6,
which corresponds to ``n = 4``, since ``4*(4 - 1)/2`` is 6.

>>> v = [1.0, 1.2, 1.0, 0.5, 1.3, 0.9]
>>> is_valid_y(v)
True

An input vector with length, say, 7, is not a valid condensed distance
matrix.

>>> is_valid_y([1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7])
False



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