Updated derivation with improved numerical stability - #1180
Conversation
|
Found 1 changed notebook. Review the changes at https://app.gitnotebooks.com/stumpy-dev/stumpy/pull/1180 |
|
@NimaSarajpoor Would you mind taking a look when you have some time? Thanks in advance! You may need to download the file in order to get the LaTex to render properly |
NimaSarajpoor
left a comment
There was a problem hiding this comment.
@seanlaw
It was great to see all the steps involved in deriving equation (91). Thanks for putting them together so clearly! I have shared a few comments for your consideration.
| "3. $dg^{T}_{i,m} = \\left( t_{i+m-1} - M_{T_{i,m}} \\right) + \\left( t_{i-1} - M_{T_{i-1,m}} \\right)$\n", | ||
| "4. $dg^{Q}_{i,m} = \\left( q_{i+m-1} - \\mu_{Q_{i,m}} \\right) + \\left( q_{i-1} - \\mu_{Q_{i-1,m}} \\right)$\n", | ||
| "\n", | ||
| "Then our equation simply becomes:\n", |
There was a problem hiding this comment.
It should be worth it to better demonstrate/explain the benefit of achieving this new equation. We can show that the new equation (91) has LARGER UPDATE and therefore should be more stable as it has less catastrophic cancelation.
Let's start with the equation (40), i.e.
Let's multiply both sides by m:
Recall that m * cov is basically the summation part of "centered sum-of-products". So, this means the update term in the equation (91), i.e. m * update (NOT update). This quickly shows that the new equation has LARGER UPDATE.
There was a problem hiding this comment.
Let's see what else we can get from the relationship between equation (40) and (91). Let's start from equation (40) again:
where
Let's multiply both sides of equation (40) by
Again, recall that m * cov is basically the summation part of "centered sum-of-products". So, if I compare the equation above with the equation (91), I can see:
Note that
Can we simply use the update term
There was a problem hiding this comment.
Maybe it's an issue on my end when things are being rendered in my Jupyter notebook but I'm only seeing a single equation number for a block of related/multiline equations:
If you are seeing the same thing, maybe we can refer to the lines as (14.1) - (14.5) (to mean lines 1-5 in equation block 14)? Otherwise, I am counting equations one-by-one each time :(
Or maybe you have a different workflow?
There was a problem hiding this comment.
Can we simply use the update term
$\frac{m−1}{m}U$ when we use the summation part of "centered sum-of-products"?
I've tried reading your comments a few times but I am unable to get your point.
Therefore, if we say that
$U$ involves the subtraction of two nearby numbers and that can lead to catastrophic cancellation, then, in that scenario, we will have "catastrophic cancellation" on the right hand side too as that is even smaller!
I feel like I'm only reading this as a statement of fact but I am getting the sense that you have a much stronger point/argument that I am overlooking :(
You started with:
It should be worth it to better demonstrate/explain the benefit of achieving this new equation.
Maybe I've been staring at the equations too long but I'm not able to see "how" this is demonstrating the benefit any further (i.e., what is the special insight that "proves" the benefit clearly). I know you so I can feel that there is something (intuition?) there. I'm just not smart enough to infer your intuition but I would like to hear more.
Pull Request Checklist
Below is a simple checklist but please do not hesitate to ask for assistance!
black(i.e.,python -m pip install blackorconda install -c conda-forge black)flake8(i.e.,python -m pip install flake8orconda install -c conda-forge flake8)pytest-cov(i.e.,python -m pip install pytest-covorconda install -c conda-forge pytest-cov)black --exclude=".*\.ipynb" --extend-exclude=".venv" --diff ./in the root stumpy directoryflake8 --extend-exclude=.venv ./in the root stumpy directory./setup.sh dev && ./test.shin the root stumpy directory and ensured that all tests are passing locallyPlease do not commit any code to avoid/circumvent a failing test and, instead, engage in a discussion (below) to determine the best course of action.
Only request a review after the checklist above is fully completed!