{
 "library": "brainference",
 "version": "1.0.0",
 "root": "8d7193fc97804cdc3aa9080728d8094732206c114f34d36b8ca2b89b943b3990",
 "license": null,
 "slug": "LocalSpatialStateDivergence",
 "ref": "LocalSpatialStateDivergence#2b5e",
 "hash": "sema:LocalSpatialStateDivergence#mh:SHA-256:2b5e93e20a335e9aff9fa14d6d8fc75b3872c759c2e7d331da7af4449062bae3",
 "stub": "2b5e",
 "layer": "Mind",
 "type": "Inference",
 "summary": "Classify a crowd's collective state from positions alone, by how far its local neighbourhoods depart from random",
 "mechanism": "A model-free (zeroth-order) measure that needs only positions per frame. At random query points, drawing circles kept inside the observation area, find the k nearest agents, split the circle into four quadrants and record the local state omega = (a1, a2, a3, a4), the count per quadrant. The state space has C(k+3, 3) states. Sample many queries per frame (60) over the whole recording to get the empirical distribution P(omega). Build Q(omega) the same way from a NullModelBaseline#9d36 that places the same number of agents uniformly at random in the same bounds at every frame. The JensenShannonDivergence#b3b4 D_JS(P, Q) then measures spatial organisation beyond chance. In fire ant colonies with k = 6, roaming scored 0.035 +/- 0.025, trailing 0.113 +/- 0.037 and aggression 0.229 +/- 0.052 (block permutation p = 0.004). k sets the spatial scale: too small is noise-dominated, too large samples too sparsely. Pushing a synthetic crowd with an attractive or repulsive force F = min(F_max, gamma / r_ij) gives a U-shaped D_JS(gamma), confirming sensitivity to order in either direction.",
 "invariants": [
  "Uses positions only, with no interaction model",
  "Empirical and null distributions share the same k, query geometry and agent counts per frame",
  "Higher D_JS means more spatial structure than uniform placement"
 ],
 "parameters": {},
 "signature": [],
 "preconditions": [
  "Reliable per-frame positions (a low-variance, rarely occluded body point)"
 ],
 "postconditions": [],
 "failure_modes": [
  "Sign ambiguity: clustering and over-dispersion both raise D_JS against a uniform reference",
  "Choosing k by maximum regime separation on the same data, a form of MotivatedInstrumentTuning#ed8f; report the full sweep",
  "Treats neighbourhoods as independent samples and ignores persistence and trajectories, so it can rank order but not explain mechanism"
 ],
 "domain": "",
 "caution": "",
 "sources": [
  {
   "kind": "thesis",
   "id": "do_2026_ant_collective_behavior",
   "note": "Ch. 3.1.1, Eqs. 3.1-3.4, Figs. 3.1-3.3; Ch. 4.1, Fig. 4.1; Ch. 5.2"
  }
 ],
 "name": "LocalSpatialStateDivergence",
 "builds_on": [
  {
   "alias": "null_model",
   "relation": "references",
   "library": "brainference",
   "slug": "NullModelBaseline",
   "ref": "NullModelBaseline#9d36",
   "url": "https://semahash.org/vocabularies/brainference/patterns/NullModelBaseline"
  },
  {
   "alias": "instrument_tuning",
   "relation": "references",
   "library": "brainference",
   "slug": "MotivatedInstrumentTuning",
   "ref": "MotivatedInstrumentTuning#ed8f",
   "url": "https://semahash.org/vocabularies/brainference/patterns/MotivatedInstrumentTuning"
  },
  {
   "alias": "jensen_shannon_divergence",
   "relation": "composes_with",
   "library": "brainference",
   "slug": "JensenShannonDivergence",
   "ref": "JensenShannonDivergence#b3b4",
   "url": "https://semahash.org/vocabularies/brainference/patterns/JensenShannonDivergence"
  }
 ],
 "related": [],
 "used_by": [
  {
   "slug": "CollectiveInformationArchitecture",
   "relation": "composes_with",
   "url": "https://semahash.org/vocabularies/brainference/patterns/CollectiveInformationArchitecture"
  },
  {
   "slug": "RepresentationDependentOrder",
   "relation": "references",
   "url": "https://semahash.org/vocabularies/brainference/patterns/RepresentationDependentOrder"
  }
 ],
 "url": "https://semahash.org/vocabularies/brainference/patterns/LocalSpatialStateDivergence",
 "md_url": "https://semahash.org/vocabularies/brainference/patterns/LocalSpatialStateDivergence.md",
 "library_url": "https://semahash.org/vocabularies/brainference"
}
