Learning to Predict in Networks with Heterogeneous and Dynamic Synapses