bundles / scipy latest / scipy / cluster / hierarchy / inconsistent
function
scipy.cluster.hierarchy:inconsistent
Signature
def inconsistent ( Z , d = 2 ) Summary
Calculate inconsistency statistics on a linkage matrix.
Parameters
Z: ndarrayThe by 4 matrix encoding the linkage (hierarchical clustering). See
linkagedocumentation for more information on its form.d: int, optionalThe number of links up to
dlevels below each non-singleton cluster.
Returns
R: ndarrayA by 4 matrix where the
i'th row contains the link statistics for the non-singleton clusteri. The link statistics are computed over the link heights for links levels below the clusteri.R[i,0]andR[i,1]are the mean and standard deviation of the link heights, respectively;R[i,2]is the number of links included in the calculation; andR[i,3]is the inconsistency coefficient,
Notes
This function behaves similarly to the MATLAB(TM) inconsistent function.
Array API Standard Support
inconsistent has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ⛔ PyTorch ✅ ⛔ JAX ✅ ⛔ Dask ⚠️ merges chunks n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
from scipy.cluster.hierarchy import inconsistent, linkage from matplotlib import pyplot as plt X = [[i] for i in [2, 8, 0, 4, 1, 9, 9, 0]] Z = linkage(X, 'ward')✓
print(Z) inconsistent(Z)✗
Aliases
-
scipy.cluster.hierarchy.inconsistent