A machine-learning approach for identifying the counterparts of submillimetre galaxies and applications to the GOODS-North field