in two steps: projection and conditional expectation. The principal curve is represented by a set of points $f_l$ (with $l=1,2,...,n$) in representation space that can be interpolated with various models of different degrees of complexity. Given our typical densities, a linear interpolation scheme is more than sufficient. This piecewise linear interpolation defines a parametrisation of the curve that can be thought of as a length along the curve, measured from one of the extremes. We defined $s(\lambda)$ as this parametrisation of the curve.

The projection step finds the point in the curve closest (in the Euclidean sense) to a given observation $\vec{m}_{CM,l}$, and assigns a coordinate value $\lambda_l$ to it. The conditional expectation step redefines the set of points $\{f_l, l=1,2,...,n\}$ used for interpolation as the expected value of colour-magnitude observations with $\lambda=\lambda_l$:

$$f_l=E({\vec{x}_{CM}}|\lambda=\lambda_l),$$

where $x_{CM}$ is the random variable from which the observations $m_{CM}$ are drawn.

Since typically each observation projects onto a different value of $\lambda$, some kind of smoothing scheme is needed in the expectation step. We used a smoothing spline [see e.g., @hastie1990generalized] of $df$ degrees of freedom, where $df$ depends on the representation space. This number of degrees of freedom is the minimum necessary to 