Distributed Learning for Cooperative Inference