Files
amlhc/.planning/phases/11-predictv3/11-VALIDATION.md
T
916117771 8b2590c5b5 docs(predictV3): 添加predictV3算法优化研究文档和前端功能实现
- 完成Phase 11: predictV3算法优化研究文档,涵盖6个优化方向的技术分析
- 实现置信度评估功能,提供历史命中率、得分分布、多维度一致性置信度指标
- 扩展回测指标体系,新增NDCG@K、MRR、命中率分布等排名质量评估指标
- 优化转移概率算法,引入二阶马尔可夫链和多属性联合转移增强预测准确性
- 设计权重训练机制,支持网格搜索和遗传算法进行数据驱动的参数优化
- 集成组合特征挖掘功能,采用关联规则和序列模式发现号码间潜在关联
- 实现完整的前端交互界面,支持预测结果显示、置信度展示和回测验证功能
- 建立性能优化策略,包括预计算缓存、批量计算和降级策略保障响应速度
2026-05-01 23:17:24 +08:00

97 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
phase: 11
phase_slug: predictv3
created: 2026-05-01
---
# Phase 11: predictV3算法优化 - Validation Strategy
## Overview
本阶段为算法优化,验证重点在于:
1. 新增指标计算准确性(NDCG、MRR、置信度)
2. 二阶马尔可夫转移矩阵构建正确性
3. 权重优化结果有效性
4. 回测命中率提升验证
## Test Framework
| Property | Value |
|----------|-------|
| Framework | PHPUnit (ThinkPHP内置) |
| Config file | 无独立配置,通过 `php think unit` 运行 |
| Quick run command | `php think unit --filter HistoryTest` |
| Full suite command | `php think unit` |
## Phase Requirements → Test Map
| Req ID | Behavior | Test Type | Automated Command | File Exists? |
|--------|----------|-----------|-------------------|-------------|
| PRED-01 | 置信度计算准确性 | unit | `php think unit --filter testConfidenceCalculation` | ❌ Wave 0 |
| PRED-02 | NDCG计算准确性 | unit | `php think unit --filter testNDCGCalculation` | ❌ Wave 0 |
| PRED-03 | 二阶马尔可夫转移矩阵构建 | unit | `php think unit --filter testTransitionMatrix2ndOrder` | ❌ Wave 0 |
| PRED-04 | 权重优化收敛性 | unit | `php think unit --filter testWeightOptimization` | ❌ Wave 0 |
| PRED-05 | 回测结果完整性 | unit | `php think unit --filter testBacktestV3Extended` | ❌ Wave 0 |
## Sampling Rate
- **Per task commit:** 快速单元测试覆盖核心方法
- **Per wave merge:** 回测验证使用真实历史数据
- **Phase gate:** 全量回测(100期)验证整体命中率提升
## Wave 0 Gaps
- [ ] `tests/HistoryTest.php` — 核心预测方法单元测试
- [ ] `tests/ConfidenceTest.php` — 置信度计算测试
- [ ] `tests/BacktestMetricsTest.php` — NDCG、MRR等指标计算测试
- [ ] 共享fixtures: 历史数据模拟生成器
## Validation Dimensions
### Dimension 8: Nyquist Test Coverage
**Target:** 每个 PLAN.md 至少有一个可验证的测试命令
| Plan | Primary Test | Coverage |
|------|--------------|----------|
| 11-01 | testBacktestV3Extended | NDCG/MRR 计算准确性 |
| 11-02 | testConfidenceCalculation | 置信度计算准确性 |
| 11-03 | 手动 UI 验证 | 前端展示正确性 |
| 11-04 | testWeightOptimization | 权重优化收敛性 |
| 11-05 | testTransitionMatrix2ndOrder | 二阶马尔可夫正确性 |
### Dimension 9: Integration Verification
**End-to-End Flow:**
1. 后端 `getPredictionV3()` 返回完整数据结构(predictions + confidence + backtest
2. 前端 `renderPredict()` 正确渲染所有新增指标
3. 回测命中率可量化对比(V2 vs V3)
**Verification Command:**
```bash
# 验证后端接口返回结构完整性
curl -s "http://localhost/history/predictV3?periods=100" | jq '.data | keys'
# 期望输出包含: predictions, confidence, backtest, analysis
# 验证 NDCG/MRR 存在
curl -s "http://localhost/history/predictV3?periods=100" | jq '.data.backtest | keys'
# 期望输出包含: hit_rate, avg_rank, ndcg_5, mrr, hit_distribution
```
## Acceptance Criteria
### Phase Gate
- [ ] NDCG@5 计算准确(单元测试通过)
- [ ] MRR 计算准确(单元测试通过)
- [ ] 置信度阈值正确(>=70%高、50-70%中、<50%低)
- [ ] 二阶马尔可夫在数据充足时启用
- [ ] 前端展示包含所有新增指标
- [ ] 回测命中率有提升(相比 V2
---
*Phase: 11-predictv3*
*Validation strategy created: 2026-05-01*