  We study the problem of learning a real-valued function that satisfies the
Demographic Parity constraint. It demands the distribution of the predicted
output to be independent of the sensitive attribute. We consider the case that
the sensitive attribute is available for prediction. We establish a connection
between fair regression and optimal transport theory, based on which we derive
a close form expression for the optimal fair predictor. Specifically, we show
that the distribution of this optimum is the Wasserstein barycenter of the
distributions induced by the standard regression function on the sensitive
groups. This result offers an intuitive interpretation of the optimal fair
prediction and suggests a simple post-processing algorithm to achieve fairness.
We establish risk and distribution-free fairness guarantees for this procedure.
Numerical experiments indicate that our method is very effective in learning
fair models, with a relative increase in error rate that is inferior to the
relative gain in fairness.
