Likelihood-free inference by ratio estimation