Formulas Reference — Companion Guide
This companion guide explains the three formulas in plain language with small numeric examples.
Use this alongside:
Section 1: Per-region coherence
Main formula:
$$\text{coherence} = \frac{\text{spread_ratio}}{1 + \text{dispersion}}$$
What each part means
- Endpoint: an anchor point at the end of a line segment.
- Centroid: the average location of all endpoints in the region.
- Distance: how far each endpoint is from the centroid.
- Spread-ratio: farthest distance divided by nearest distance.
- Dispersion: standard deviation of distances divided by mean distance.
Step-by-step
- Collect all endpoint coordinates in one region.
- Compute centroid by averaging all x values and all y values.
- Compute each endpoint's distance to centroid.
- Compute:
- $\text{spread_ratio} = \max(d)/\min(d)$
- $\text{dispersion} = \sigma_d/\mu_d$
- Compute coherence:
- $\text{coherence} = \text{spread_ratio}/(1+\text{dispersion})$
Working example
Distances to centroid: 4, 5, 5, 6
- $\max(d)=6$, $\min(d)=4$ so spread-ratio $=6/4=1.5$
- mean $\mu_d = (4+5+5+6)/4 = 5$
- std dev $\sigma_d$ (population form) is computed as:
- deviations from mean: $(4-5, 5-5, 5-5, 6-5) = (-1, 0, 0, 1)$
- squared deviations: $(1, 0, 0, 1)$
- variance $= (1+0+0+1)/4 = 0.5$
- std dev $\sigma_d = \sqrt{0.5} \approx 0.707 \approx 0.71$
- dispersion $=0.707/5=0.1414\approx0.142$
Coherence:
$$\text{coherence}=\frac{1.5}{1+0.142}=\frac{1.5}{1.142}\approx1.31$$
Interpretation: higher coherence means stronger geometric organisation around that region's centroid.
Section 2: Diversity coefficient between two regions
Main formula:
$$\sigma_{ij} = \frac{|c_i - c_j|}{\max(c_i, c_j)}$$
What each part means
- $c_i, c_j$: coherence values for two regions.
- $|c_i-c_j|$: absolute difference between them.
- $\max(c_i,c_j)$: larger coherence value.
- $\sigma_{ij}$: normalized contrast between the two regions.
Working examples
Example A:
- $c_i=10$, $c_j=4$
- absolute difference $=|10-4|=6$
- max $=10$
- $\sigma=6/10=0.6$
Example B:
- $c_i=8$, $c_j=8$
- difference $=0$
- $\sigma=0/8=0$
Interpretation:
- $\sigma=0$ means identical coherence values.
- Larger $\sigma$ means stronger contrast.
Section 3: Pair-loss regression
Main formula (run-2 operational dataset):
$$\text{Loss} = -5.5567\,\sigma + 16.2611, \quad R^2=0.2035$$
What each part means
- Slope $-5.5567$: when $\sigma$ increases by 1, predicted loss decreases by 5.5567.
- Intercept $16.2611$: predicted loss when $\sigma=0$.
- $R^2$: share of variation in loss explained by the model.
Working examples
If $\sigma=0$:
$$\text{Loss}=-5.5567(0)+16.2611=16.2611$$
If $\sigma=0.5$:
$$\text{Loss}=-5.5567(0.5)+16.2611=13.48275$$
If $\sigma=0.9$:
$$\text{Loss}=-5.5567(0.9)+16.2611=11.26007$$
Interpretation: in this run, higher pair contrast predicts lower loss.
Because this run-2 line is regressive (downward slope), the slope term is negative: $-5.5567$. If the relationship were positive (upward slope), this coefficient would be positive instead.
Note on $R^2$
Definition:
$$R^2 = 1 - \frac{SS_{res}}{SS_{tot}}$$
Simple terms:
- $SS_{res}$ is the leftover error after using the regression line (how far observed points are from the line).
- $SS_{tot}$ is the total variation in observed Loss values before using any line.
- So $R^2$ asks: "How much of the total variation is explained by the line?"
- If $R^2=0$, the line explains none of the variation; if $R^2=1$, it explains all of it.
Manual workflow for one point (example at $\sigma=0.35$):
- Compute the line value at that x-position:
- $\hat y = -5.5567(0.35) + 16.2611 = 14.316255$
- Read the actual observed value for that same point from the scatter:
- Compute residual (vertical gap):
- $e = y_{actual} - \hat y$
- Square it:
- Repeat for every point and sum:
- $R^2=0.2035$ means about 20% of observed loss variation is explained by $\sigma$ in this run.
Quick map across sections
- Section 1 gives one coherence value per region.
- Section 2 compares two region coherence values.
- Section 3 models pair loss from the Section 2 value across all pairs.
Math mechanics
This section states the same ideas in explicit mathematical mechanics, so you can explain both the intuition and the formal basis.
A. Why Formula 1 is structure-sensitive but scale-invariant
Formula 1:
$$
ext{coherence} = \frac{\max(d)/\min(d)}{1 + \sigma_d/\mu_d}
$$
If every distance is multiplied by a constant $k>0$ (uniform scaling), then:
- $\max(kd)/\min(kd) = \max(d)/\min(d)$
- $\sigma_{kd}/\mu_{kd} = (k\sigma_d)/(k\mu_d) = \sigma_d/\mu_d$
So coherence is unchanged by pure size scaling. It responds to geometric arrangement, not absolute scale.
B. Why Formula 2 is normalized and bounded
Formula 2:
$$
\sigma_{ij} = \frac{|c_i-c_j|}{\max(c_i,c_j)}
$$
For nonnegative coherence values:
- lower bound: $|c_i-c_j| \ge 0 \Rightarrow \sigma_{ij} \ge 0$
- upper bound: $|c_i-c_j| \le \max(c_i,c_j) \Rightarrow \sigma_{ij} \le 1$
Hence $0 \le \sigma_{ij} \le 1$. This makes pair comparisons commensurable across different magnitude levels.
C. How the regression coefficients are mechanically obtained
Let $x=\sigma$ and $y=\text{Loss}$. Linear regression fits:
$$
\hat y = mx + b
$$
by minimizing:
$$
\sum_i\left(y_i-(mx_i+b)\right)^2
$$
Closed-form coefficients:
$$
m = \frac{\operatorname{Cov}(x,y)}{\operatorname{Var}(x)}, \qquad b = \bar y - m\bar x
$$
So the slope sign comes from covariance:
- if $\operatorname{Cov}(x,y)<0$, then $m<0$ (downward line)
- if $\operatorname{Cov}(x,y)>0$, then $m>0$ (upward line)
D. Residuals and what $R^2$ is actually measuring
For each point:
$$
e_i = y_i - \hat y_i
$$
Residuals are vertical gaps on the plot (not geometric shortest distance to the line).
Then:
$$
R^2 = 1 - \frac{SS_{res}}{SS_{tot}} = 1 - \frac{\sum_i e_i^2}{\sum_i (y_i-\bar y)^2}
$$
Interpretation: fraction of total variation in observed Loss explained by the fitted line.
E. 20-second mechanics script (presentation-ready)
- Formula 1 compresses region geometry into a scale-invariant coherence score.
- Formula 2 turns two coherence scores into a normalized contrast in $[0,1]$.
- Formula 3 regresses pair Loss on that contrast across all pairs; the slope sign is set by covariance.