Skip to content
Glacius
ProbabilityConcept reference

Expected values

A finite expectation is the sum of each value multiplied by its probability.

On this page 7 sections
  1. Overview
  2. Weight by how often a value occurs
  3. Keep values and weights separate
  4. A mean need not be an outcome
  5. Key takeaway
  6. Sources & further reading
  7. Concept connections

01Weight by how often a value occurs#

An expectation is the average specified by a probability model. A possible value contributes in proportion to its probability. The model supplies the weights; the number of distinct outcomes does not.

Suppose XX is 00 with probability 0.750.75 and 44 with probability 0.250.25. In an imagined collection that follows those proportions exactly, three quarters contribute zero and one quarter contribute four. The average contribution is 11.

Outcomes 0, 4 have probabilities 0.75, 0.25. The balance point is the mean 1.Outcomes 0, 4 have probabilities 0.75, 0.25. The balance point is the mean 1.
Figure 1Outcomes 0, 4 have probabilities 0.75, 0.25. The balance point is the mean 1.
Link to this figure ↗Download SVGDownload PNG

Multiply each value by its probability, then add:

E[X]=∑xx p(x).E[X]=\sum_x x\,p(x).

The index runs over the possible values. Every probability is nonnegative, and the complete set sums to one.

Check your reasoning

PMF: p(0)=0.75p(0)=0.75, p(8)=0.25p(8)=0.25. Find E[X]E[X].

Show answer and explanation
2

Weighted sum: 0(0.75)0(0.75) + 8(0.25)8(0.25) = 22.

02Keep values and weights separate#

For values −2,1,5-2,1,5 with probabilities 0.5,0.3,0.20.5,0.3,0.2, the contributions are −1,0.3,1-1,0.3,1. Their sum is 0.30.3. A negative value contributes negatively; its probability remains positive.

Averaging the three values equally would answer a different question. Equal weighting is justified only when their probabilities are equal. Repeated observations can be summarized by frequencies, provided those frequencies supply the weights.

Check your reasoning

A model assigns numerical rewards −4-4, 66, with respective probabilities 0.7, 0.3. Find the expected reward E[X]E[X].

Show answer and explanation
-1

Weighted sum: −4(0.7)-4(0.7) + 6(0.3)6(0.3) = −1-1.

03A mean need not be an outcome#

When only 00 and 44 can occur, an expectation of 11 does not predict that the next observation will be 11. It describes the model's weighted average. Keep the value even when it is fractional or absent from the set of outcomes.

Check your reasoning

PMF: p(0)=0.5p(0)=0.5, p(3)=0.5p(3)=0.5. A learner rounds the mean to a possible outcome. Find the unrounded E[X]E[X].

Show answer and explanation
1.5

Weighted sum: 0(0.5)0(0.5) + 3(0.5)3(0.5) = 1.51.5. Keep this mean.

If XX represents a model's loss on a randomly drawn example, E[X]E[X] is its expected loss. For losses 11 and 99 occurring with probabilities 0.90.9 and 0.10.1, expected loss is 1.81.8. The rare large loss contributes 0.90.9, as much as all the common small losses together.

Moving probability δ\delta from a lower value aa to a higher value bb increases the mean by δ(b−a)\delta(b-a). This explains why changing the population weights can change expected performance without changing the loss values themselves.

Key takeaway

Multiply by probabilities, preserve signs, and keep the weighted mean even when it cannot occur.

  • Compute a finite random variable's expectation.

Sources & further reading

  1. [1]
  2. [2]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Expected values.” Math behind ML. /learn/p-expectation