  Due to the pervasive diffusion of personal mobile and IoT devices, many
"smart environments" (e.g., smart cities and smart factories) will be,
generators of huge amounts of data. Currently, analysis of this data is
typically achieved through centralised cloud-based services. However, according
to many studies, this approach may present significant issues from the
standpoint of data ownership, as well as wireless network capacity. In this
paper, we exploit the fog computing paradigm to move computation close to where
data is produced. We exploit a well-known distributed machine learning
framework (Hypothesis Transfer Learning), and perform data analytics on mobile
nodes passing by IoT devices, in addition to fog gateways at the edge of the
network infrastructure. We analyse the performance of different configurations
of the distributed learning framework, in terms of (i) accuracy obtained in the
learning task and (ii) energy spent to send data between the involved nodes.
Specifically, we consider reference wireless technologies for communication
between the different types of nodes we consider, e.g. LTE, Nb-IoT, 802.15.4,
802.11, etc. Our results show that collecting data through the mobile nodes and
executing the distributed analytics using short-range communication
technologies, such as 802.15.4 and 802.11, allows to strongly reduce the energy
consumption of the system up to $94\%$ with a loss in accuracy w.r.t. a
centralised cloud solution up to $2\%$.
