feat(factor): C1 因子相关性分析(横截面 Spearman 矩阵 + API)
- evaluation.factor_correlation_report:多因子共同日期 ∩ 后逐日横截面 Spearman 相关 取均值 → FactorCorrelationReport(冗余剔除前置,v3 §12 Correlation→Redundancy) - ResearchService.run_factor_correlation + POST /api/factor-correlations (universe/factors/period;与其它研究同装配口径) - tests/test_factor_correlation.py:矩阵对角=1/近线性±相关符号/对称/无共同日期补零、 API 冒烟;全量 pytest 通过
This commit is contained in:
@@ -232,6 +232,22 @@ class FactorTestReport(BaseModel):
|
||||
config_snapshot: dict = Field(default_factory=dict)
|
||||
|
||||
|
||||
# ---------- 因子相关性 / 暴露分析(C1,v3 §12) ----------
|
||||
|
||||
|
||||
class FactorCorrelationReport(BaseModel):
|
||||
"""多因子两两相关(横截面相关逐日均值;v3 §12 冗余剔除前置)。"""
|
||||
|
||||
factors: list[str]
|
||||
corr_matrix: dict[str, dict[str, float]] = Field(
|
||||
default_factory=dict, description="{f1: {f2: spearman 相关系数}}(对角线=1)"
|
||||
)
|
||||
sample_days: int = 0
|
||||
sample_min_symbols: int = 0
|
||||
unimplemented: list[str] = Field(default_factory=list)
|
||||
config_snapshot: dict = Field(default_factory=dict)
|
||||
|
||||
|
||||
# ---------- 异步 Job 与 Experiment(Phase 4) ----------
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user