  In the mobile-edge-cloud continuum, a plethora of heterogeneous data sources
and computation-capable nodes are available. Such nodes can cooperate to
perform a distributed learning task, aided by a learning controller (often
located at the network edge). The controller is required to make decisions
concerning (i) data selection, i.e., which data sources to use; (ii) model
selection, i.e., which machine learning model to adopt, and (iii) matching
between the layers of the model and the available physical nodes. All these
decisions influence each other, to a significant extent and often in
counter-intuitive ways. In this paper, we formulate a problem addressing all of
the above aspects and present a solution concept called RightTrain, aiming at
making the aforementioned decisions in a joint manner, minimizing energy
consumption subject to learning quality and latency constraints. RightTrain
leverages an expanded-graph representation of the system and a delay-aware
Steiner tree to obtain a provably near-optimal solution while keeping the time
complexity low. Specifically, it runs in polynomial time and its decisions
exhibit a competitive ratio of $2(1+\epsilon)$, outperforming state-of-the-art
solutions by over 50%. Our approach is also validated through a real-world
implementation.
