@yuanzhec The value of pdf (probability distribution function) represents the probability of generating a random sample wi. If the function generate_sample produces a random sample wi, then the probability of generating that random sample wi is non-zero, hence pdf != 0. So we are never dividing by zero here.

What if pdf = 0?

@yuanzhec The value of

`pdf`

(probability distribution function) represents the probability of generating a random sample`wi`

. If the function`generate_sample`

produces a random sample`wi`

, then the probability of generating that random sample`wi`

is non-zero, hence`pdf != 0`

. So we are never dividing by zero here.