{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function behaves similarly to the MATLAB(TM) "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "inconsistent"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "R",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "(n-1)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by 4 matrix where the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "'th row contains the link statistics for the non-singleton cluster "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The link statistics are computed over the link heights for links "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " levels below the cluster "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "i"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "R[i,0]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "R[i,1]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are the mean and standard deviation of the link heights, respectively; "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "R[i,2]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of links included in the calculation; and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "R[i,3]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the inconsistency coefficient,"
                    }
                  ]
                },
                {
                  "__type": "Math",
                  "__tag": 4058,
                  "value": "\\frac{\\mathtt{Z[i,2]} - \\mathtt{R[i,0]}} {R[i,1]}"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calculate inconsistency statistics on a linkage matrix."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "Z",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "(n-1)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " by 4 matrix encoding the linkage (hierarchical clustering).  See "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "linkage",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.cluster.hierarchy._hierarchy_impl:linkage"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " documentation for more information on its form."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "d",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of links up to "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " levels below each non-singleton cluster."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "build-install/usr/lib/python3.14/site-packages/scipy/cluster/hierarchy/_hierarchy_impl.py",
  "item_line": 1628,
  "item_type": "function",
  "aliases": [
    "scipy.cluster.hierarchy.inconsistent"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.cluster.hierarchy import inconsistent, linkage\nfrom matplotlib import pyplot as plt\nX = [[i] for i in [2, 8, 0, 4, 1, 9, 9, 0]]\nZ = linkage(X, 'ward')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "print(Z)\ninconsistent(Z)\n",
        "execution_status": "failure",
        "out": "array([[0.     , 0.     , 1.     , 0.     ],\n       [0.     , 0.     , 1.     , 0.     ],\n       [1.     , 0.     , 1.     , 0.     ],\n       [0.57735, 0.8165 , 2.     , 0.70711],\n       [1.04044, 1.06124, 3.     , 1.01851],\n       [3.11614, 1.40689, 2.     , 0.70711],\n       [6.44583, 6.76771, 3.     , 1.12682]])\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "Z",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "d",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "2"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "inconsistent"
  },
  "references": null,
  "qa": "scipy.cluster.hierarchy._hierarchy_impl:inconsistent",
  "arbitrary": [],
  "local_refs": [
    "R",
    "Z",
    "d"
  ]
}