# Confused about the definition of "closest negative"

The definition of the closest negative as shown in the following picture is not as I understand from the lecture. As I understand, the “closest negative” is the nearest value (positive or negative) to the diagonal value in the same row. But here, it is defined as “the largest number less than or equal zero”. According to the last definition, a positive off-diagonal value is not considered the closest negative even if it is the nearest value to the diagonal value in that row.
Can anyone help me understand this ?

Thank you

The “closest negative” value is the closest value that is less than or equal to zero (because here the word “negative” means values that are less than zero). If the question would have been “closest” (without word - negative) then the nearest value (positive or negative) would have been correct.

Edit:
Actually, you are correct, the correct answer should not be explained to be less than or equal to zero. According to lecture notes, the value should be smaller than the Anchor value and does not need to be less than zero.

Hi @arvyzukai ,

According to the lecture notebook “C3_W4_lecture_nb_2_Modified_Triplet_Loss” the definition of the closest negative doesn’t include larger/smaller than zero. The closest negative is (according to the lecture and notebook) the negative example (off diagonal) that the cosine is the largest value that is still smaller than the value on the diagonal of the specific row.

See the code that described this part:

``````mask_1 = np.identity(b) == 1            # mask to exclude the diagonal
mask_2 = sim_an > sim_ap.reshape(b, 1)  # mask to exclude sim_an > sim_ap
``````

What still confuses me about this is why to exclude the cases in which `sim_an > sim_ap.reshape(b, 1)` (why conditioning the value to be less than the diagonal row). According to what I understand, if the value is greater then the diagonal - then this is even a worse example of confusion, isn’t it? why should we exclude this case as a hard example?

Yes, you are correct. The word “negative” usually means the negative example (off-diagonal), and not the less than zero value. But there are inconsistencies when word “negative” is used and sometimes it is used to describe not just the negative example but also the less than zero value. Actually, now I think the quiz explanation should be corrected as you both noted to be more consistent with the course material.

Regarding you question about hard mining I would suggest to read my explanation to the same question: