Skip to content

test: add neutralize module tests (11 cases)#33

Merged
initial-d merged 1 commit into
initial-d:mainfrom
redamancy231-create:test-neutralize
Jul 16, 2026
Merged

test: add neutralize module tests (11 cases)#33
initial-d merged 1 commit into
initial-d:mainfrom
redamancy231-create:test-neutralize

Conversation

@redamancy231-create

Copy link
Copy Markdown
Contributor

内容

为 features.neutralize 模块补充测试。这是论文复现表中唯一 tests 列为 — 的模块,现在补齐。

测试覆盖(11 个用例)

neutralize_cs(5 个)

  • 基本行为:每日期横截面 z-score,均值≈0
  • Mask 处理:masked 单元输出为 0
  • 常量输入:无截面变异 → 全零
  • 边界:单只股票 → 全零
  • 边界:全部 masked → 全零

neutralize_industry(6 个)

  • 基本行为:行业 OLS 残差,均值≈0
  • 附加 log_size 连续回归量
  • Mask 处理
  • 边界:单只可交易股票
  • 边界:完全共线(所有股票同一行业)
  • 截面标准差归一化验证

Coverage:
- neutralize_cs: basic z-score, mask handling, const values, single stock, all masked
- neutralize_industry: basic OLS, with log_size, mask handling, single stock,
  perfect collinearity, cross-sectional std normalisation

Previously the only module in the paper-reproduction table with no tests.
Co-Authored-By: Claude <noreply@anthropic.com>

@initial-d initial-d left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the added neutralization coverage. The cases match the current masked z-score and industry residualization behavior, and all CI jobs pass.

@initial-d
initial-d merged commit f672d73 into initial-d:main Jul 16, 2026
3 checks passed
initial-d added a commit that referenced this pull request Jul 16, 2026
Pairing: add neutralize module test coverage
@initial-d

Copy link
Copy Markdown
Owner

Thanks for adding the neutralization coverage. I rebuilt the integration history to keep this contribution consistent with the project's pairing workflow:

  • preserved the contributor authorship on the test commit
  • reconstructed the commit with maintainer attribution and removed the AI-tool co-author trailer
  • integrated the contribution through an explicit two-parent merge commit instead of a squash commit
  • preserved the exact code tree; this was a history/metadata correction only

The rebuilt contribution commit is 3442a2c, the #33 integration commit is 810ea1e, and the resulting main CI is green on Python 3.9, 3.10, and 3.11.

redamancy231-create added a commit to redamancy231-create/ml-quant-trading that referenced this pull request Jul 16, 2026
- Merge upstream initial-d#34 + initial-d#33 with review fixes
- Keep upstream load_validation_panel validation + docs
- Keep 21-test neutralize suite with guard fix
- Keep source-aware _select_tickers + VWAP fix
Co-Authored-By: Claude <noreply@anthropic.com>
redamancy231-create added a commit to redamancy231-create/ml-quant-trading that referenced this pull request Jul 16, 2026
- Merge upstream initial-d#34 + initial-d#33 with review fixes
- Keep upstream load_validation_panel validation + docs
- Keep 21-test neutralize suite with guard fix
- Keep source-aware _select_tickers + VWAP fix
Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants