  Many statistical and machine learning approaches rely on pairwise distances
between data points. The choice of distance metric has a fundamental impact on
performance of these procedures, raising questions about how to appropriately
calculate distances. When data points are real-valued vectors, by far the most
common choice is the Euclidean distance. This article is focused on the problem
of how to better calculate distances taking into account the intrinsic geometry
of the data, assuming data are concentrated near an unknown subspace or
manifold. The appropriate geometric distance corresponds to the length of the
shortest path along the manifold, which is the geodesic distance. When the
manifold is unknown, it is challenging to accurately approximate the geodesic
distance. Current algorithms are either highly complex, and hence often
impractical to implement, or based on simple local linear approximations and
shortest path algorithms that may have inadequate accuracy. We propose a simple
and general alternative, which uses pieces of spheres, or spherelets, to
locally approximate the unknown subspace and thereby estimate the geodesic
distance through paths over spheres. Theory is developed showing lower error
for many manifolds, with applications in clustering, conditional density
estimation and mean regression. The conclusion is supported through multiple
simulation examples and real data sets.
