Closed wuyangjian closed 7 months ago
maxlp = max(maxlp, logprob) probs = {key: 2**(lp - maxlp) for key, lp in logprobs.items()} which means lp-maxlp always equals 0
Yes, the most likely class i
will have probs[i] = 1
at this point. Next the values are normalized so that they sum up to 1 (i.e. make a proper probability distribution), and all will be below one.
Subtracting the highest log-prob before applying the exponential function is a common trick to avoid large log-probs to get rounded to zero probabilities due to the lack of numerical precision. If you do the math, you'll notice that it doesn't affect the result after the normalization to probability values.
I'll close this issue now, but please do reply if there's still something that seems to be wrong.
I apologize for the delayed response. I have now understood the issue correctly, and it was indeed a misunderstanding on my part. I confused the LMClassifierFilter and CrossEntropyFilter modules. Thank you very much for your answer. I really appreciate your project, as it has been very helpful to me.
problem: