Scale-bridging by learning slow collective coordinates