bundles / scipy latest / scipy / spatial / distance / is_valid_y
function
scipy.spatial.distance:is_valid_y
source: /scipy/spatial/distance.py :2434
Signature
def is_valid_y ( y , warning = False , throw = False , name = None ) Summary
Return True if the input array is a valid condensed distance matrix.
Extended Summary
Condensed distance matrices must be 1-dimensional numpy arrays. Their length must be a binomial coefficient for some positive integer n.
Parameters
y: array_likeThe condensed distance matrix.
warning: bool, optionalInvokes a warning if the variable passed is not a valid condensed distance matrix. The warning message explains why the distance matrix is not valid.
nameis used when referencing the offending variable.throw: bool, optionalThrows an exception if the variable passed is not a valid condensed distance matrix.
name: str, optionalUsed when referencing the offending variable in the warning or exception message.
Returns
: boolTrue if the input array is a valid condensed distance matrix, False otherwise.
Examples
from scipy.spatial.distance import is_valid_y
✓v = [1.0, 1.2, 1.0, 0.5, 1.3, 0.9] is_valid_y(v)✓
is_valid_y([1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7])
✓Aliases
-
scipy.cluster._optimal_leaf_ordering.is_valid_y