STDP enables spiking neurons to detect hidden causes of their inputs