Allow defining globalGuess() in bootstrap traits#2553
Conversation
|
@lballabio it looks like AppVeyor has some issues with VC++ version. |
Currently, GlobalBootstrap uses the regular Traits::guess() method. This method was designed for IterativeBootstrap and usually uses previous points to make the guess for the next point. In some traits (ZeroYield, ForwardRate, SimpleZeroYield) it also uses methods that rely on curve's interpolation (zeroRate(), forwardRate()). However, GlobalBootstrap does NOT update interpolation while computing initial guess, so the result is not well defined. We could update interpolation before calling guess() but: 1. This would add significant overhead. 2. Since GlobalBootstrap doesn't run optimizations until it got initial guesses for all points, the guesses are basically a constant, so this seems excessive. Instead, add a new method, globalGuess(), which does not use previous points or rely on interpolation. For traits that don't define it, keep using the old logic. Also, make Traits::transformDirect()/transformInverse() methods optional so we don't have to define them for traits that don't need them.
8864079 to
d17986c
Compare
|
Tiny risk of breaking if someone inherited from the traits and called the parent |
|
@lballabio That's a fair point. I can put them back with a deprecation attribute if you prefer. However, I agree with you that it's quite unlikely that anyone is using them. Especially since the ones I'm deleting are all no-ops, they simply return their argument back, so there's little point in calling them. Also, I apologize, I need to rework this change a bit, so I've put this PR in draft for now. I'll mark it as ready when I'm done. |
|
Ok, thanks. |
|
As for the methods, I'd remove them and not bother with deprecation. |
|
This PR was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks. |
Currently, GlobalBootstrap uses the regular Traits::guess() method. This method was designed for IterativeBootstrap and usually uses previous points to make the guess for the next point. In some traits (ZeroYield, ForwardRate, SimpleZeroYield) it also uses methods that rely on curve's interpolation (zeroRate(), forwardRate()). However, GlobalBootstrap does NOT update interpolation while computing initial guess, so the result is not well defined. We could update interpolation before calling guess() but:
This would add significant overhead.
Since GlobalBootstrap doesn't run optimizations until it got initial guesses for all points, the guesses are basically a constant, so this seems excessive.
Instead, add a new method, globalGuess(), which does not use previous points or rely on interpolation. For traits that don't define it, keep using the old logic.
Also, make Traits::transformDirect()/transformInverse() methods optional so we don't have to define them for traits that don't need them.