bolunwang / backdoor

Code implementation of the paper "Neural Cleanse: Identifying and Mitigating Backdoor Attacks in Neural Networks", at IEEE Security and Privacy 2019.
https://sandlab.cs.uchicago.edu/
MIT License
267 stars 64 forks source link

y_true and y_pred position #11

Closed shihongf closed 3 years ago

shihongf commented 3 years ago

Hi, I'm curious that why the position of y_true and y_pred get exchange? Is this a mistake or it is done on purpose? Can you please explain why? Thanks! https://github.com/bolunwang/backdoor/blob/e8577747d4670366a02db3818bf60f978d4c6421/visualizer.py#L233

Shawn-Shan commented 3 years ago

I believe the result should be identical. You can print out the two values and make sure they are the same.

shihongf commented 3 years ago

Thanks for answering. It is actually not the same, that's why I was asking. If you check here: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/losses/categorical_crossentropy. y_true should be placed before y_pred.