{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nLet $G = (V, E)$ be a finite undirected [[graph|00C0BR7D7H]], and let $\\mathcal{C}$ be the set of its [[cliques|0BYX1D7C2E]].\nFor each $v \\in V$ let $S_v$ be a finite set, and let $X = (X_v)_{v \\in V}$ be a random vector with values in $\\prod_{v \\in V} S_v$.\nAssume that its probability mass function $p$ is strictly positive: $p(x) \u003e 0$ for every $x$.\nFor $C \\subseteq V$ write $x_C = (x_v)_{v \\in C}$.\nThen the following are equivalent.\n\n1. $X$ is a [[Markov random field|6W69H3A3G5]] with respect to $G$.\n2. There are functions $\\psi_C \u003e 0$, one for each $C \\in \\mathcal{C}$, such that for all $x$,\n$$p(x) = \\prod_{C \\in \\mathcal{C}} \\psi_C(x_C).$$\n\n## Remarks\n\nThat 2 implies 1 is direct.\nLet $S$ separate $A$ from $B$, and enlarge $A$ and $B$ so that $A \\cup B \\cup S = V$ while $S$ still separates them.\nNo clique meets both $A$ and $B$, so each clique lies in $A \\cup S$ or in $B \\cup S$.\nSo $p$ is a function of $(x_A, x_S)$ times a function of $(x_B, x_S)$, which gives $X_A \\perp X_B \\mid X_S$.\nFor 1 implies 2, one writes $\\log p$ as a sum of terms indexed by the subsets of $V$, by Möbius inversion.\nThe pairwise Markov property then shows that the terms of the non-cliques vanish.\nThis second step needs positivity, since it takes logarithms and divides by $p$.\nThe direction 2 implies 1 holds without positivity, but the direction 1 implies 2 can fail.\nThere are Markov random fields with zero probabilities on a cycle of four vertices that do not factorise over the cliques.\n\nExample: for the Ising model on $G$, $p(x) \\propto \\exp\\bigl(\\beta \\sum_{\\set{u, v} \\in E} x_u x_v + h \\sum_v x_v\\bigr)$ with $x_v \\in \\set{-1, 1}$.\nThis is a product of positive factors on edges and vertices, which are cliques, so the Ising model is a Markov random field.\n\n## Explanations\n\n### L1 human\n\nThe theorem says two descriptions of a random field agree.\nOne description lists independence facts: each variable cares only about its neighbours.\nThe other gives a formula: the probability is a product of terms, each involving only a group of mutually adjacent variables.\nThis holds as long as no configuration has probability zero.\n\n### L2 human\n\nThe theorem is why Markov random fields are written as Gibbs distributions $p(x) \\propto \\exp(-\\sum_C V_C(x_C))$ with clique potentials $V_C$.\nConversely, any such energy defines a Markov random field, and in Gibbs sampling the update of $x_v$ then depends only on the neighbours of $v$.\nThe same statement holds for positive densities with respect to a product measure, for example for Gaussian graphical models.\nThere the missing edges of the graph are the zero entries of the inverse covariance matrix.\nFor directed graphs, the analogous factorisation is the definition of a [[Bayesian network|21JT983G60]].\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "6W69H3A3G5"
    ],
    "kind": "statement",
    "msc": [
      "62H22",
      "60G60"
    ],
    "name": "Hammersley–Clifford theorem",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q5645731",
      "wikipedia": "Hammersley–Clifford theorem"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Hammersley%E2%80%93Clifford_theorem"
      }
    ],
    "tag": "K07QH8EKD0",
    "uses": [
      "6W69H3A3G5",
      "0BYX1D7C2E",
      "00C0BR7D7H",
      "0THJ7416DX"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/K07QH8EKD0/",
  "links": [
    {
      "field": "about",
      "target": "6W69H3A3G5"
    },
    {
      "field": "uses",
      "target": "6W69H3A3G5"
    },
    {
      "field": "uses",
      "target": "0BYX1D7C2E"
    },
    {
      "field": "uses",
      "target": "00C0BR7D7H"
    },
    {
      "field": "uses",
      "target": "0THJ7416DX"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/K07QH8EKD0.md",
  "msc": [
    "62H22",
    "60G60"
  ],
  "name": "Hammersley–Clifford theorem",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/K07/K07QH8EKD0.md",
  "status": null,
  "tag": "K07QH8EKD0",
  "uri": "m2://K07QH8EKD0",
  "url": "https://tamnd.github.io/math2/wiki/hammersley-clifford-theorem/",
  "writing": {
    "tag": "K07QH8EKD0",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
