Back to Reasoning under uncertainty
Shared AI lesson · Reasoning under uncertainty
Understand bayesian evidence
- Starting information
A rare condition and a positive signal
- Relationship or operation
Combine prior frequency with signal reliability
- Consequence
A revised belief, not automatic certainty
A prior is belief before the signal; a posterior is belief after it. False positives can dominate when the condition is rare.
The idea in everyday terms
A positive sensor reading must be interpreted alongside how common the fault was before the reading. Even a sensor that detects most faults can produce more false alarms than genuine alarms when healthy cases are much more common.
What to watch in the experiment
Count the expected faulty and healthy alarms, then divide genuine alarms by all alarms. That gives the probability of a fault after an alarm under the assumptions. It is different from the probability of an alarm when a fault exists.
What this does not establish
The calculation depends on the base rate and sensor model. Repeated readings are not automatically independent, and an impossible observation has no defined posterior probability.
Full worked explanation, calculations and control definitions
Use this reference for the detailed mechanism and control meanings. Derivations explicitly marked optional are enrichment.
Count where an alarm could come from
Imagine 10,000 manufactured parts. Suppose 1% are faulty: 100 faulty and 9,900 healthy. A sensor detects 90% of the faulty parts, so we expect 90 genuine alarms and 10 missed faults. It also alarms on 5% of the healthy parts: 495 false alarms and 9,405 correctly quiet parts.
Among the 585 alarms, only 90 come from faulty parts. The faulty fraction of the alarm group is 90 ÷ 585, about 15.38%. That is very different from the 90% detection rate. Both numbers are correct under the assumptions; they answer different questions.
These are authored probabilities and expected frequencies, not measurements of a deployed sensor. A finite real batch would vary, and the rates themselves would need evidence. Changing the imagined cohort size scales the expected counts without changing the proportions. At some settings an expected count is fractional; this does not mean someone observed a fraction of a part.
Name the three probabilities
The prior probability is the belief before this sensor reading. Here P(F) = 0.01, where F means “the part is faulty.” It describes the intended population. A rate measured in a factory’s repair queue might be a poor prior for parts freshly leaving production.
The likelihood describes how probable the observation is under a specified hidden state. If A means “alarm,” then P(A | F) = 0.90 is the detection rate. The vertical bar reads “given”: probability of alarm given a faulty part. P(A | H) = 0.05 is the false-alarm rate among healthy parts, where H means “healthy.” This two-state model assumes every part is in exactly one of F or H.
The posterior probability updates the hidden-state belief after seeing the evidence. P(F | A) asks for the faulty share of the alarm group. It is not P(A | F): the conditioning event and therefore the denominator have changed.
The lab’s first bar uses all 10,000 parts as its denominator. The second expands the selected reading group to a full-width bar. Its denominator is smaller and explicitly labelled. Compare proportions within each row; do not interpret equal drawn widths across rows as equal numbers of parts.
Multiply along a path, then normalize across explanations
An alarm can arise through two disjoint paths: faulty and detected, or healthy and falsely alarmed. Multiply the probability of each underlying state by the likelihood of an alarm in that state:
Here P(F,A) is the joint probability of being faulty and producing an alarm. The healthy-alarm contribution is 0.99 × 0.05 = 0.0495. Add the two to obtain the total alarm probability, 0.0585. The posterior is the faulty contribution divided by that total:
Read this as: among all ways an alarm could happen, what share came from faulty parts? The numerator is 0.009; the denominator is 0.009 + 0.0495. The result is approximately 0.1538, or 15.38%. Dividing the expected counts 90 by 585 gives the same answer because the common cohort size cancels.
The total evidence probability must be positive for this finite conditional-probability calculation. The denominator is not a numerical inconvenience to patch with an arbitrary small constant; it describes whether the selected observation can happen in the stated model.
Change the population before changing the sensor
Keep detection at 90% and false alarms at 5%, but change the prior fault rate to 20%. Out of 10,000 parts, we now expect 1,800 genuine alarms and 400 false alarms. The posterior becomes 1,800 ÷ 2,200, about 81.82%. The sensor’s conditional rates did not change. The population mix did.
This is why quoting detection performance alone can mislead a decision-maker. It leaves out both the base rate and the other way an alarm can arise. A posterior also does not automatically tell you what action to take. Inspection cost, missed-fault cost, available alternatives and the quality of the rate estimates belong in a separate decision problem.
Select a quiet reading next. Under the original rare-fault settings, the relevant cells are 10 missed faults and 9,405 healthy quiet parts. The posterior is 10 ÷ 9,415, about 0.106%. You must change the entire evidence group, not merely replace the numerator while keeping the alarm denominator.
Uninformative and impossible observations
If detection and false alarms are equal, a possible reading is equally likely in either hidden state. It supplies no information for distinguishing them, so the posterior stays at the prior. If alarms are more likely on healthy parts than on faulty ones, an alarm can lower the fault probability. “Alarm” is a label; the likelihoods determine the information it conveys.
Now set both alarm rates to zero and select an alarm. Both joint contributions are zero. There is no alarm group in this model, so its faulty share is undefined, not zero. If a real sensor produces an observation that the model says is impossible, investigate the model, rates, data pipeline or event description. Dividing zero by zero does not justify certainty about either state.
The endpoint priors 0 and 1 need the same care. A nonzero-likelihood observation cannot create positive posterior mass for a state assigned exactly zero prior mass. If the observation also excludes every state with positive prior mass, conditioning is undefined. Extreme prior assumptions can therefore be fragile.
Do two alarms provide two pieces of evidence?
The paired-reading control concerns the same part with an unchanged hidden state. Under conditional independence, one reading does not change the probability of the other after the true state is specified. The two readings have the same detection and false-alarm rates in this exercise.
For two independent alarms given a fault, the likelihood is 0.90 × 0.90 = 0.81. Given a healthy part, it is 0.05 × 0.05 = 0.0025. With the 1% prior, expected counts among 10,000 parts are 81 faulty double alarms and 24.75 healthy double alarms. The resulting posterior is about 76.60%.
This multiplication requires independence within both hidden-state groups. It does not imply the two readings are independent across a mixed population: they share information about the same hidden fault. Shared interference or correlated failure modes could also invalidate the assumed within-state independence.
Choose the exact-copy model instead. A duplicated alarm has the same joint likelihood as the first alarm, so its posterior remains 15.38%. The duplicated dashboard entry is not a second measurement. A first alarm followed by a quiet copy is impossible under this exact-copy model; the lab reports an undefined posterior instead of inventing a result. These are two deliberately different dependence assumptions, not competing claims about a measured device.
Practice, then audit the assumptions
The separate practice batch gives 16 alarms among 20 faulty parts and 49 among 980 healthy parts. Work from those counts before checking feedback. The question is the faulty fraction of all alarms, so choose the alarm-group denominator. A detection-rate calculation answers a different question.
For guided evidence, export rare/common population comparisons and explain each denominator. For implementation evidence, reconstruct the four cells, check that they sum to the cohort total, and test zero-probability, equal-likelihood and copied-reading cases without substituting a fabricated posterior. For a decision brief, state where a credible prior and sensor likelihoods would come from, which population they describe and why repeated records do or do not constitute new evidence.
Three temporary captures and a bounded note can be exported before leaving. No model is trained, and no required path percentage changes.