Interaction-Based Distributed Learning in Cyber-Physical and Social Networks