Network-Aware Optimization of Distributed Learning for Fog Computing