AI Glossary / Mathematics and optimization / Advanced

Posterior (prediction)

Definition

In the prediction sense used here, a posterior is the conditional probability distribution of an unknown label or target given observed features. Written P(y | x), it describes which outcomes remain plausible after the input x is known. A prediction rule uses this distribution together with a loss function to choose an output or action.

What it means

The same input can be compatible with several outcomes. A model might assign probabilities to different categories or describe a range of possible numeric targets. The conditional distribution retains that uncertainty; one selected label or number summarizes it for a particular purpose.

This glossary term concerns the target conditional on features. It should be distinguished from a posterior distribution over model parameters given training data. A Bayesian posterior predictive distribution can additionally average predictions over uncertain parameters, but that extra construction is not implied merely by writing P(y | x).

How it works

Specify the target, observed features, and a probabilistic model relating them. The conditional distribution may be learned directly or obtained from a joint model through conditioning. In classification, it assigns probabilities to candidate labels whose total is one.

To turn that distribution into a decision, calculate expected loss for each candidate action and choose an action with minimum expected loss. With equal-cost classification errors, selecting a most probable class minimizes conditional error probability. When different mistakes have different costs, the most probable class need not be the preferred action.

For numeric targets, squared-error prediction selects the conditional mean when the relevant expectation is finite. Absolute-error prediction selects a conditional median. Thus the distribution provides the information for optimal prediction under a specified loss; it does not determine one universal best answer independent of the decision criterion.

Three practical examples

1. Message routing: use category probabilities to distinguish a clear routing choice from an ambiguous message that may need review.

2. Demand planning: use a conditional distribution of demand to support decisions with different consequences for excess supply and shortages.

3. Quality inspection: translate a probability of a defect into a review decision using the costs and constraints of the inspection workflow.

Think of it this way

Think of a weather forecast that narrows possible outcomes after considering current observations. Choosing whether to move an event indoors depends both on the forecast and on the consequences of rain. The analogy is limited: a probability estimate can be poorly calibrated, and its usefulness depends on whether the model's conditions resemble the actual situation.

Worked example

Suppose the conditional probability of a positive class for one input is 0.70, with negative-class probability 0.30. Under equal-cost errors, predicting positive has expected loss 0.30, while predicting negative has expected loss 0.70. Positive is therefore preferred.

Now assign loss 8 to a false positive and loss 2 to a false negative, with zero loss for correct decisions. Predicting positive has expected loss 8 × 0.30 = 2.4. Predicting negative has expected loss 2 × 0.70 = 1.4. The preferred decision becomes negative even though positive remains the more probable label.

For a general positive probability p, predict positive when 8(1 − p) < 2p, or p > 0.8. At p = 0.8 the two actions tie under these invented costs. The probability distribution has not changed; the decision criterion has.

A numeric example makes the same point. Suppose a target is 0 with probability 0.6 and 10 with probability 0.4. Its conditional mean is 4. Predicting 4 gives expected squared error 0.6 × 16 + 0.4 × 36 = 24, compared with 40 for predicting 0. Under absolute error, predicting 0 gives expected loss 4, while predicting 4 gives 4.8. Different losses favor different summaries. These are hand-checked examples with supplied probabilities, not model-validation results.

Illustrative case study

Fictional case: Willow Support receives category probabilities from a routing model. Its first version always chooses the largest probability, even for messages where a costly misroute is plausible.

The team separates probability estimation from routing policy. It defines the permitted actions, including review where appropriate, and specifies the relevant consequences. Analysts inspect calibration on representative held-out messages and evaluate the resulting policy separately from classification accuracy. They also retain the full probability vector in their evaluation record so that policy changes can be reviewed. No operational improvement is claimed for this fictional system.

Common misconceptions and mistakes

A posterior class probability is not a certainty, a causal explanation, or proof that a person belongs to a category. It is a conditional statement within a model and information set. Adding new information can change the distribution.

Do not confuse P(y | x) with P(x | y). They answer different questions, and relating them requires the appropriate prior and normalization. Nor should an uncalibrated model score be presented as a reliable probability merely because it lies between zero and one.

Finally, “optimal prediction” is conditional on the loss and the assumed distribution. An inaccurate distribution or incomplete cost model can produce a poor real-world decision.

Business use

For business use, document what the probabilities refer to, which information was available, and how the decision rule uses them. Keep the estimator and action policy conceptually separate so that changing business costs does not require pretending the underlying probabilities changed.

Review calibration, distribution shifts, and outcome availability. A high-probability output can still require human review if the action's consequences or the quality of the input warrant it.

People also ask

Is this always a Bayesian parameter posterior?

No. The source term here means the label distribution conditional on features.

Is the most probable class always the best action?

Only for appropriate loss assumptions, such as equal-cost classification error.

Can a numeric prediction differ from every possible target value?

Yes. A conditional mean can lie between possible outcomes, as the worked example shows.

Check your understanding

With positive probability 0.7 and false-positive cost 8 versus false-negative cost 2, which action has lower expected loss?

Answer: Predicting negative, with expected loss 1.4 rather than 2.4. This follows from the stated costs, not from changing the probabilities.

Related terms

  • Conditional probability
  • Posterior predictive distribution
  • Calibration
  • Conditional means
  • Loss function
  • posterior distribution
  • Bayes decision rule
  • conditional mean

Learn next

derive a decision threshold from a cost table, then compare label uncertainty with uncertainty about model parameters.

More in Mathematics and optimization

  • Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
  • Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
  • Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
  • Σ-algebra
  • Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
  • Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.

Sources

Primary source: Aalto Dictionary of Machine Learning, posterior (prediction), posterior distribution, and conditional-probability context: https://aaltodictionaryofml.github.io/ADictML_Main.pdf . The prediction entry was read. Editorial scope: P(y | x) is distinguished explicitly from a parameter posterior and Bayesian parameter averaging. All numerical decisions and the fictional case are original.

Previous: Posterior Next: Posterior predictive check

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer