learn_lisa_clusters
learn_lisa_clusters(
side=12,
block=3,
shift=2.0,
alpha=0.05,
permutations=999,
seed=0,
)Plant hot and cold spots, then watch LISA find them (and sometimes cry wolf).
Draws iid noise on a side x side lattice, shifts a block x block hot block up by shift and a cold block down by the same amount, and runs local Moran (LISA) with significance masking at alpha. The map shows the recovered High-High / Low-Low clusters with the planted blocks outlined; the summary reports the hit rates and the false-positive share — a reminder that with hundreds of local tests, some cells are flagged by chance alone.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| side | int | Lattice side length (n = side²); must fit two disjoint blocks. | 12 |
| block | int | Side length of each planted block. | 3 |
| shift | float | Size of the planted level shift (in standard deviations of the noise). | 2.0 |
| alpha | float | Significance level masking the cluster labels (p_sim < alpha). |
0.05 |
| permutations | int | Conditional permutations behind the local pseudo p-values. | 999 |
| seed | int | Random seed (drives both the noise and the permutations). | 0 |
Returns
| Name | Type | Description |
|---|---|---|
| SandboxResult | df (one row per cell with planted and detected labels), fig, summary, topic and the raw field in data. |
Examples
import geometrics as gm
res = gm.learn_lisa_clusters(shift=2.0)
print(res.summary["sensitivity_hot"], res.summary["false_positive_rate"])