bundles / scipy latest / scipy / cluster / hierarchy / maxinconsts
function
scipy.cluster.hierarchy:maxinconsts
Signature
def maxinconsts ( Z , R ) Summary
Return the maximum inconsistency coefficient for each non-singleton cluster and its children.
Parameters
Z: ndarrayThe hierarchical clustering encoded as a matrix. See
linkagefor more information.R: ndarrayThe inconsistency matrix.
Returns
MI: ndarrayA monotonic
(n-1)-sized numpy array of doubles.
Notes
Array API Standard Support
maxinconsts 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 median, inconsistent, maxinconsts from scipy.spatial.distance import pdist✓
X = [[0, 0], [0, 1], [1, 0], [0, 4], [0, 3], [1, 4], [4, 0], [3, 0], [4, 1], [4, 4], [3, 4], [4, 3]]✓
Z = median(pdist(X)) R = inconsistent(Z)✓
Z R✗
maxinconsts(Z, R)
✗See also
- inconsistent
for the creation of a inconsistency matrix.
- linkage
for a description of what a linkage matrix is.
Aliases
-
scipy.cluster.hierarchy.maxinconsts