Forecasting contagion processes on heterogeneous complex networks