A Generalised Solution to the Out-of-Sample Extension Problem in Manifold Learning