Building the inference model