  We consider the estimation of a bounded regression function with
nonparametric heteroscedastic noise and random design. We study the true and
empirical excess risks of the least-squares estimator on finite-dimensional
vector spaces. We give upper and lower bounds on these quantities that are
nonasymptotic and optimal to first order, allowing the dimension to depend on
sample size. These bounds show the equivalence between the true and empirical
excess risks when, among other things, the least-squares estimator is
consistent in sup-norm with the projection of the regression function onto the
considered model. Consistency in the sup-norm is then proved for suitable
histogram models and more general models of piecewise polynomials that are
endowed with a localized basis structure.
