viewof semc_threshHigh = Inputs.range([25, 40], {value: 30, step: 0.5, label: "High Threshold (C)"})
viewof semc_threshLow = Inputs.range([10, 25], {value: 18, step: 0.5, label: "Low Threshold (C)"})
viewof semc_baseline = Inputs.range([15, 35], {value: 22, step: 0.5, label: "Baseline Temperature (C)"})
viewof semc_spikeChance = Inputs.range([0, 20], {value: 3, step: 1, label: "Anomaly Spike Chance (%)"})
viewof semc_summaryMin = Inputs.range([1, 15], {value: 5, step: 1, label: "Summary Interval (minutes)"})
viewof semc_simDuration = Inputs.range([5, 60], {value: 15, step: 5, label: "Simulation Duration (minutes)"})Event Compression Simulator
Event Compression Simulator
animation
analytics-ml
edge
compression
Try Change Anomaly Spike Chance (%) from 3 to 20.
Observe Watch Events Extracted, Compression Ratio, and Samples Producing Events at 20% spike chance.
Explain Explain why 30% of spikes also produce Anomaly Detections.
Technical boundaries. The formulas use 1 Hz sampling and expected spikes rather than a continuous sensor stream. High Threshold (C), Low Threshold (C), and Baseline Temperature (C) do not affect the results.
NoteEvent Compression Simulator
Configure thresholds and signal behavior to see how semantic compression extracts only meaningful events from a continuous sensor stream. Most samples produce zero events – that is the compression.
semc_totalSamples = semc_simDuration * 60 // 1 Hz sampling
semc_rawBytes = semc_totalSamples * 8
semc_summaryEvents = Math.floor(semc_simDuration / semc_summaryMin)
// Simulate: each sample has semc_spikeChance% of crossing threshold
semc_expectedSpikes = Math.round(semc_totalSamples * (semc_spikeChance / 100))
semc_stateChanges = Math.min(semc_expectedSpikes * 2, semc_totalSamples) // enter + exit spike
semc_anomalyEvents = Math.round(semc_expectedSpikes * 0.3) // 30% of spikes also flag as anomaly
semc_totalEvents = semc_summaryEvents + semc_stateChanges + semc_anomalyEvents
semc_eventBytes = semc_summaryEvents * 80 + semc_stateChanges * 100 + semc_anomalyEvents * 120
semc_ratio = semc_eventBytes > 0 ? semc_rawBytes / semc_eventBytes : semc_rawBytes
semc_pctTransmit = (semc_totalEvents / semc_totalSamples) * 100html`<div style="background: var(--bs-light, #f8f9fa); border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 8px; padding: 1.2rem; color: var(--bs-body-color);">
<h4 style="margin-top:0; color: #2C3E50;">Semantic Compression Results</h4>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem;">
<div style="padding: 0.6rem; background: rgba(231,76,60,0.08); border-radius: 6px; text-align: center;">
<div style="font-size: 0.8rem; color: #374151;">Raw Input</div>
<div style="font-size: 1.5rem; font-weight: bold; color: #9f1d1d;">${semc_totalSamples.toLocaleString()} samples</div>
<div style="font-size: 0.85rem; color: #374151;">${(semc_rawBytes/1024).toFixed(1)} KB</div>
</div>
<div style="padding: 0.6rem; background: rgba(22,160,133,0.08); border-radius: 6px; text-align: center;">
<div style="font-size: 0.8rem; color: #374151;">Events Extracted</div>
<div style="font-size: 1.5rem; font-weight: bold; color: #0f6b5c;">${semc_totalEvents} events</div>
<div style="font-size: 0.85rem; color: #374151;">${semc_eventBytes} bytes</div>
</div>
</div>
<table style="width:100%; border-collapse: collapse; font-size: 0.9rem;">
<tr style="border-bottom: 1px solid var(--bs-border-color, #dee2e6);">
<th scope="row" style="padding: 5px 8px; font-weight: normal; text-align: left;">Periodic Summaries (every ${semc_summaryMin} min)</th>
<td style="padding: 5px 8px; text-align: right; color: #0d47a1;">${semc_summaryEvents} events</td>
</tr>
<tr style="border-bottom: 1px solid var(--bs-border-color, #dee2e6);">
<th scope="row" style="padding: 5px 8px; font-weight: normal; text-align: left;">State Change Events (threshold crossings)</th>
<td style="padding: 5px 8px; text-align: right; color: #8a4a00;">${semc_stateChanges} events</td>
</tr>
<tr style="border-bottom: 1px solid var(--bs-border-color, #dee2e6);">
<th scope="row" style="padding: 5px 8px; font-weight: normal; text-align: left;">Anomaly Detections (statistical outliers)</th>
<td style="padding: 5px 8px; text-align: right; color: #474091;">${semc_anomalyEvents} events</td>
</tr>
<tr style="border-bottom: 1px solid var(--bs-border-color, #dee2e6);">
<th scope="row" style="padding: 5px 8px; font-weight: normal; text-align: left;"><strong>Compression Ratio</strong></th>
<td style="padding: 5px 8px; text-align: right; font-weight: bold; color: #0f6b5c;">${semc_ratio.toFixed(0)}:1</td>
</tr>
<tr>
<th scope="row" style="padding: 5px 8px; font-weight: normal; text-align: left;"><strong>Samples Producing Events</strong></th>
<td style="padding: 5px 8px; text-align: right;">${semc_pctTransmit.toFixed(1)}% of samples</td>
</tr>
</table>
<p style="margin-top: 0.8rem; padding: 0.5rem; background: rgba(155,89,182,0.08); border-radius: 4px; font-size: 0.85rem;">
<strong>Insight:</strong> ${semc_pctTransmit < 5 ? "With only " + semc_pctTransmit.toFixed(1) + "% of samples generating events, semantic compression is highly effective for this signal -- most of the data is 'nothing happening'." : semc_pctTransmit < 20 ? "Moderate event rate at " + semc_pctTransmit.toFixed(1) + "% -- semantic compression is still beneficial but consider lowering anomaly sensitivity or widening thresholds." : "High event rate at " + semc_pctTransmit.toFixed(1) + "% -- thresholds may be too tight. Consider widening the normal range or the signal may genuinely be volatile, in which case statistical aggregation may be more appropriate."}
</p>
</div>`