| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Near-constant input made var(y) ~= 0, so the expanding rsquare kernel leaked inf / garbage values. The NaN guard (isclose(std, 0)) existed only on the rolling branch; mirror it on the expanding branch. Fixes microsoft#2297
|
@microsoft-github-policy-service agree |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
Thanks for the LGTM xv (@itsadrianxv)! Happy to address any remaining review notes — the fix and the regression tests are ready for CI once approved. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What
Mirrors the existing near-constant-window NaN guard from the rolling branch onto the expanding (N == 0) branch of Rsquare in qlib/data/ops.py.
Near-constant input makes �ar(y) ~= 0, so expanding_rsquare (kernel:
um / sqrt(var_x * var_y)) leaks inf / garbage values on the expanding path, while the rolling path already masks those windows:
`python
rolling branch (already guarded):
series.loc[np.isclose(_series.rolling(self.N, min_periods=1).std(), 0, atol=2e-05)] = np.nan
`
This PR applies the equivalent guard with expanding(min_periods=1).std() on the N == 0 branch.
Tests
Added ests/ops/test_rsquare.py:
The tests use a mocked feature (no data download / no qlib.init needed).
Fixes #2297