On the consistency between model selection and link prediction in networks