The geometry of surprise