SciPy

scipy.spatial.distance.is_valid_y

scipy.spatial.distance.is_valid_y(y, warning=False, throw=False, name=None)[source]

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 \({n \choose 2}\) for some positive integer n.

Parameters
yndarray

The condensed distance matrix.

warningbool, 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.

throwbool, optional

Throws an exception if the variable passed is not a valid condensed distance matrix.

namebool, optional

Used when referencing the offending variable in the warning or exception message.

Previous topic

scipy.spatial.distance.is_valid_dm

Next topic

scipy.spatial.distance.num_obs_dm