A question about "denominator" obtained by the function <_compute_normalizer>
See original GitHub issueThank you for your awesome work. I am confused about the calculation process of the denominator. Why do you need to perform additions for each step in the loop? https://github.com/kmkurn/pytorch-crf/blob/master/torchcrf/__init__.py#L245
next_score = torch.logsumexp(next_score, dim=1)
I think that this operation is done at the end of the loop and does not need to be executed inside the loop. I am confused about this. Can you give me some explanation?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Rationalizing Denominators and Numerators of Radical
Step 1: Multiply numerator and denominator by a radical that will get rid of the radical in the denominator. If the radical in...
Read more >Intro to rationalizing the denominator | Algebra (video)
Learn for free about math, art, computer programming, economics, physics, chemistry, biology, medicine, finance, history, and more. Khan Academy is a ...
Read more >Identifying numerators and denominators | Math (video)
I just looked at a couple of the practice problems. The denominator = the number of equal parts that make one whole unit....
Read more >How To Find a Common Denominator? Definition, Examples ...
We can obtain common denominators by multiplying both numerator (top) and denominator (bottom) by the same amount. For example, consider the addition of...
Read more >numden - Extract numerator and denominator - MathWorks
This MATLAB function converts A to a rational form where the numerator and denominator are relatively prime polynomials with integer coefficients.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes. Instead of
sum
, we dologsumexp
. This is because we’re working in log probability space. Let me give an example.Suppose we want to compute
r
, the sum two probabilitiesp
andq
. That is,r = p + q
. This is straightforward to do. However, suppose now we’re working in log probability space. That is, we don’t havep
andq
, but we instead havex
andy
wherex = log p
andy = log q
. Also, we now want to computez = log r
fromx
andy
. How do we do that? Note thatr = p + q = exp(x) + exp(y)
and thusz = log(exp(x) + exp(y))
. Notice how a sum in probability space (i.e. in terms ofp, q, r
) becomes a log-sum-exp in log probability space (i.e. in terms ofx, y, z
).Hope this helps.
You’re welcome. Glad that I could help 😃