Repository navigation
Conversation
This was referenced Oct 27, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Factor screening currently pools stock-days into one correlation and applies limit masking after factor computation. This corrects screening to daily pairwise IC/RankIC with mask-first factors, and adds streamed factor consumption plus an opt-in stable rolling backend for memory-sensitive research.
Long trailing mean/std/cov/corr calculations allocate work proportional to the window length. This adds opt-in O(T*N) FP64 block moments and connects them to the actual factor APIs and feature CLI, while preserving the default
unfoldbehavior.compute_legacy_set(..., rolling_backend="linear"),compute_alpha_set(...), andmlquant features --rolling-backend linearnow use the selected implementation through a thread/async-local scope. Config selection also works indemo;features.ptrecords the backend. Existing imported aliases inside registered factors route correctly, and exceptions restore the caller's selection.During full-engine testing, the original global-prefix approach lost small variances after large past outliers. The final algorithm combines disjoint block prefixes/suffixes, each centred at an observation included in that piece. Independent FP64 oracle regressions cover this failure, masks, causality, gradients and block boundaries. The inaccurate pre-fix runs remain archived.
Correct daily factor screening
daily_factor_ic(values, targets, factor_mask, label_mask)computes [T] Pearson IC and average-tie Spearman RankIC across assets. Nonfinite pairs are excluded before ranks; insufficient/constant cross-sections are missing dates instead of zero IC. Signal availability stays separate from retrospective label eligibility.scripts/eval_factor_ic.pynow streams all 213 factors, with limit masking before factor construction, adjacent finite positive raw-close labels and per-date series/pair counts. Summaries weight eligible dates equally. A regression demonstrates daily IC -1 becoming pooled IC >+0.99 when levels change across dates; independent SciPy tests cover ties, masks and nonfinite inputs.The complete 500 x 200 synthetic run completed at source
410f6a6, with 431–498 eligible dates per factor. This is full-sample diagnostic screening; no factor selection/holdout, costs, temporal-dependence correction or alpha claim. Complete series, command, environment, input hashes and checks.Stream factors without materializing the feature cube
iter_legacy_factors(panel, names=None, neutralize=True, rolling_backend="unfold")yields(name, values, mask)in the same order ascompute_legacy_set. Backend scopes end before yielding and the previous result is released on resumption. Freeze the panel/registry, avoid mutating masks, and discard outputs/autograd graphs to obtain the memory benefit.Apple M5 CPU, code
7b90abf, synthetic 750 x 1000, all 213 neutralized factors followed by per-factor mean/RMS reductions, 1/1 threads, 1 warmup / 3 repeats, fresh subprocesses:Opt-in rolling backend: measured behavior and limits
Apple M5 CPU, 1/1 threads, 2 warmups / 5 repeats, seeded synthetic input, code
2620ac1. Fresh process per backend/case; peak RSS includes the interpreter, output tensors and allocator caches.old_071sampled mean Spearman was 0.9770. Switching backend changes numerical semantics and requires research validation.Complete raw reports, commands/environment, per-factor diagnostics and preserved failure. The October 24 17.57x global-prefix result is preserved as historical evidence and does not describe the final repaired implementation.
Validation
python -m pytest: 240 passed, including full-213 streaming equivalence for both backends and neutralization modes, lazy/release/context checks, both complete demo backends and thread/async isolation.python -m ruff check src tests scripts/benchmark_factor_backends.py scripts/benchmark_rolling_moments.py scripts/benchmark_factor_streaming.py scripts/eval_factor_ic.py: passed.GitHub CI passed Python 3.9 / 3.10 / 3.11 at updated head
a20717bb5d8e31c94fd1dbdc0feb05c2a7ad9620: run. Independent maintainer review is required before merge.