The math behind the panic
Every number on the main page comes from the formulas below, run in your browser on the current alarm log. Numbers in yellow are live. No AI, no servers, just a probability model that has seen some things.
1 Alarms as random arrivals
Start simple. If alarms happen independently at an average rate r per day, the number of alarms N in t days follows a Poisson distribution:
The chance of at least one alarm is one minus the chance of none:
Two problems: we don't know r, and the alarm clearly prefers some hours over others. Steps 2 and 3 fix those.
2 How often? A Gamma belief about the rate
Instead of pretending to know r, the model keeps a whole Gamma distribution of plausible rates, with shape α and rate β:
Read α as "alarms seen" and β as "days watched". Before any data it starts from a mild hunch: alarm per days. Then each real alarm adds to α and each observed day adds to β, but older ones count less. With a half-life of h = days, something u days old has weight :
| Alarm | Age u (days) | Weight |
|---|
Right now: α = , β = days, so the model expects about one alarm every days.
3 When? Hour and weekday shapes
Alarms aren't spread evenly, so the rate becomes a function of time. That makes this a non-homogeneous Poisson process:
Each past alarm drops a small Gaussian bump on the clock, wrapping round so 11pm sits next to midnight. A flat layer of imaginary alarms keeps one weird night from becoming a prophecy. Both curves are scaled to average exactly 1, so they move the odds around the week without changing the total.
4 Putting it together
For any window, add up how risky each moment is. That's the exposure Λ, measured in "average days":
Averaging the Poisson chance of zero alarms over every plausible rate in the Gamma belief has a neat closed form:
So for the next 24 hours, with Λ = :
That is the big number on the main page, shown between 1% and 99% because popcorn is never impossible. The full count distribution is a negative binomial. Here it is for the next 7 days:
5 The other numbers
"Next alarm predicted" is the moment the model gives even odds that the alarm has already gone off. Set the chance of zero alarms to ½ and solve for the exposure:
Then it walks forward hour by hour, adding up the risk of each hour, until the exposure reaches that much: . Risky hours add up faster, so the prediction tends to land in the middle of the night.
"Likely window" does the same for ¼ and ¾. The next alarm has a 50% chance of landing between and , a 25% chance of coming sooner and a 25% chance of coming later.
FIRE-CON is just the 24-hour chance in buckets: 5 under , 4 under , 3 under , 2 up to , and 1 above that.
6 Is it any good? The backtest
For every past day, the model is refitted using only the alarms before that day, makes a forecast pd, and gets scored against what happened (od = 1 for an alarm, 0 for none). The Brier score is the average squared miss, so lower is better:
The baseline is the lazy version of the same model: one constant rate, no memory loss and no clock shape.
7 Honest caveats
- A handful of alarms is a tiny dataset. Expect the numbers to jump around.
- A missing alarm looks exactly like a quiet day, so gaps in the log make the building look calmer than it is.
- The model assumes alarms don't cause each other. Anyone who has lived through a Double Feature may disagree.
- It knows nothing about drills, microwaves, weather or actual fires. Never use it to decide whether to evacuate.