Conditional expectation asks for the average value of an outcome after restricting attention to a condition. E[Y|X = a] is the expected value of Y among cases with X = a; operationally, condition on X = a by filtering to those rows, then examine the resulting distribution or its mean. This can differ from the unconditional expectation E[Y] because the composition of cases changes after conditioning. section 1.5.2
Figure 1.8 On the left is a sample of a variable y. On the right, the same data is split by two different values of x, giving the conditional distributions for different xs. The central black dots are the means for each group, so on the left is the unconditional expectation and on the right are the two conditional expectations.
Compare the overall mean of Y with the means after splitting Y by values of X. The group means are conditional expectations, while the single mean is unconditional. section 1.5.2
For prediction under squared-error loss, the mean is the best single prediction for a collection of values. Once inputs are available, the corresponding target is the conditional expectation: a predictive model learns the average outcome associated with each input configuration, rather than trying to reproduce every observed outcome. section 4.1.2 section 4.2.5
Predicting signal rather than noise
Write an observed outcome as Y = E[Y|X] + ε. For a given x, the observed y may depart from its conditional expectation because of ε, whose conditional mean is zero. A model that follows each observed point too closely learns noise; a useful predictive model instead targets E[Y|X]. Cross-validation and cross-fitting help keep fitting focused on that target rather than the training observations. section 4.2.5
Conditional expectation has distinct roles in prediction and causal analysis:
- In supervised learning, estimating E[Y|X] supports forecasting the most likely or average outcome from patterns in past data. This use depends on future events behaving similarly to past events. section 4.0
- In causal inference, E[Y|X,Z] can supply the conditional quantity needed by the adjustment formula when Y has many possible values. A supervised learning model can estimate it in the presence of many confounders. section 4.2
- A conditional expectation is observational: it describes outcomes associated with observed conditions. It is not, by itself, an interventional expectation such as E[Y|do(X = x)], which concerns changing X. section 4.0

