In the ungraded lab, the formula for precision_i in section 1.2 is different from the code in section 1.4. I have checked the paper that introduces BLEU score, the formula is the same as the implementation in section 1.4.

I don’t know why the author of the lab gives different formula in section 1.2 and this confuses me.

Hi @nguyen1207

Which formula in section 1.2 do you find confusing?

Thanks for your reply.

This is the precision formula in section 1.2

But in the implementation section 1.4 step 2, the author implements a different formula that includes the weights while the formula in section 1.2 does not.

No problem

Are you referring to the `weights`

variable in the `clipped_precision()`

function of STEP 2? If that’s the case, those `weights`

represent the exponents for each n-gram (up to 4 in this scenario) precision, and they are used in the calculation of BLEU as follows:

BLEU = BP \times \Bigl(\prod_{i=1}^{4} \text{precision}_i\Bigr)^{(1/4)}

The `weights`

are applied “outside” of the precision calculation. Alternatively, if you’re referring to different weights, please clarify.

I think I get it now. 2 formulas are actually the same. I just need to apply some log formulas to transform these 2 formulas.

Thank you.