Explainability Layer · y = f(x)

The AI-Quantum decision function, written out in full — then taken apart by SHAP and LIME

One score drives advisory, credit and recovery routing. Here it is as an explicit function of eight measured inputs: angle-encoded onto qubits, measured as Z and ZZ expectations, squashed to a probability, and then attributed feature-by-feature with Shapley values (global-consistent, additive) and a LIME local surrogate (fast, local, with a stated fidelity).

Simulation notice: the quantum stage is a classical emulation of a variational circuit (product-state angle encoding with ZZ couplings). No quantum hardware is used and no quantum speed-up is claimed. Shapley values are a Monte-Carlo permutation estimate; LIME reports its own local R² so you can see when the linear surrogate is not trustworthy.

The function

closed form · deterministic · differentiable
x̂ᵢ = clip((xᵢ − minᵢ) / (maxᵢ − minᵢ), 0, 1)
θᵢ = π · orient(x̂ᵢ)    |ψᵢ⟩ = Ry(θᵢ)|0⟩
⟨Zᵢ⟩ = −cos θᵢ    ⟨ZᵢZⱼ⟩ = ⟨Zᵢ⟩⟨Zⱼ⟩
z = b + Σᵢ wᵢ(⟨Zᵢ⟩ + 1) + Σ₍ᵢⱼ₎ Jᵢⱼ⟨ZᵢZⱼ⟩
y = f(x) = σ(z) = 1 / (1 + e⁻ᶻ)

orient() flips features where low is good (EC, THI), so every θ runs from "bad" at 0 to "good" at π. The ZZ terms are the entangling layer: they let moisture change what salinity means, and heat change what microbial activity means, instead of adding effects independently.

Coupling layer Jᵢⱼ
⟨Z_ndvi·Z_vwc⟩+0.550.070
⟨Z_vwc·Z_ec⟩-0.600.399
⟨Z_thi·Z_microbe⟩-0.400.234
⟨Z_purity·Z_price⟩+0.45-0.183
⟨Z_rain·Z_vwc⟩+0.350.313
Bias b
-3.40

Inputs x

8 measured channels

Output y

action confidence
f(x)
0.7555
GO
Approve advisory + credit tranche; hold inputs steady
logit z1.1284
baseline f(x₀)0.9959
Δ vs baseline-0.2404
Σφ (SHAP)-0.2404
efficiency gap0.0000
LIME local R²0.763

Efficiency: Shapley values must sum to f(x) − f(baseline). The gap above is pure Monte-Carlo noise — raise the permutation count to shrink it.

SHAP · Shapley attribution

φᵢ = E_π[ f(x_{S∪i}) − f(x_S) ] · permutation estimator
Permutations1920 model calls
baseline f(x₀)0.9959
Root-zone EC0.996
-0.0720
Microbial activity proxy0.924
-0.0375
Livestock THI0.886
-0.0305
NDVI (vegetation)0.856
-0.0293
Soil moisture VWC0.827
-0.0278
Recovered-stream purity0.799
-0.0154
Mandi price vs MSP0.783
-0.0143
Rain anomaly (7d vs LPA)0.769
-0.0136
f(x)0.7555
Narrative (top 3 drivers)
  • Root-zone EC at 3.60 pulls the score down by -0.0720 (15% favourable on its own scale).
  • Microbial activity proxy at 0.33 pulls the score down by -0.0375 (27% favourable on its own scale).
  • Livestock THI at 78.00 pulls the score down by -0.0305 (38% favourable on its own scale).
Local gradient ∂f/∂xᵢ (unit-scaled)
Recovered-stream purity+0.9681
NDVI (vegetation)+0.7895
Microbial activity proxy+0.6111
Mandi price vs MSP+0.4923
Root-zone EC-0.0947
Livestock THI-0.0232
Soil moisture VWC+0.0161
Rain anomaly (7d vs LPA)+0.0025

LIME · local surrogate

g(z) = w₀ + Σ wᵢzᵢ fitted on kernel-weighted perturbations
Kernel width σ320 samples · R² 0.763 · w₀ 0.659
Root-zone EC
-0.108
Microbial activity proxy
-0.070
Soil moisture VWC
-0.036
Livestock THI
-0.033
Recovered-stream purity
0.032
Rain anomaly (7d vs LPA)
-0.029
Mandi price vs MSP
-0.028
NDVI (vegetation)
-0.015
How to read the two methods together

SHAP answers "how much of the distance from the baseline farm does this feature own?" — additive and consistent, but it costs 1920 model evaluations. LIME answers "if I nudge this farm slightly, which knob moves the score fastest?" — one small regression, valid only inside the σ neighbourhood.

Agreement check
NDVI (vegetation)-0.029-0.015same sign
Soil moisture VWC-0.028-0.036same sign
Root-zone EC-0.072-0.108same sign
Livestock THI-0.030-0.033same sign
Rain anomaly (7d vs LPA)-0.014-0.029same sign
Microbial activity proxy-0.037-0.070same sign
Recovered-stream purity-0.0150.032DISAGREE
Mandi price vs MSP-0.014-0.028same sign

A sign disagreement is a real signal, not a bug: it means the response is curved between the baseline and this point, so the linear surrogate cannot represent it. Widen σ or trust the Shapley value.

Response curve

y = f(xᵢ | all other inputs held fixed)
0.000.250.450.721.00f(x) = 0.7560.304.20