Browser Python Demo
Interactive Tensor SPC Residual Demo
This lightweight example runs Python in your browser using Pyodide. It illustrates how a structured sensor × time observation can produce a residual-energy Q statistic when an anomaly is introduced.
Controls
Change the simulated anomaly
Adjust the localized fault strength and noise level, then rerun the calculation. The demo forms a small low-rank approximation and computes Q as squared residual energy. The highlighted region is the known ground-truth location where the simulated fault was introduced.
Loading Python runtime…
Results
Q statistic response
Run the demo to compute the residual energy.
Residual Heatmap
Where residual energy appears
The heatmap is generated from the same Python run as the Q values above. It shows squared residual energy after subtracting the low-rank structured approximation. The blue box marks the known ground-truth location where the simulated fault was introduced; it is not a detected region. Because the heatmap shows model error rather than raw signal, the highlighted region may or may not be the highest-energy area.
Why this matters
Q detects unmodeled structure
In Tensor SPC, the Q statistic measures energy outside the modeled multilinear structure. In this simplified two-mode example, the retained components capture the dominant smooth pattern, while localized behavior may remain in the residual.
- Low Q: observation is close to the learned structure.
- High Q: observation contains localized or unmodeled behavior.
- Blue box: shows where the synthetic fault was injected, not what the model detected.
- Heatmap: shows model error. High energy inside the box means the anomaly was not captured; low energy means the model partially or fully absorbed it.
Important: the heatmap reflects residual/model error, not the raw data. This is an educational demonstration, not the full research workflow. The full monograph develops the broader tensor monitoring framework.
Next step
From demo to application
A production app can extend this idea with file uploads, rank selection, T²-Q monitoring charts, residual heatmaps, and Excel/PDF reporting. The browser demo is intended to make the core idea visible without requiring installation.