Step optimization backtest estimate can disagree with the enumerated grid

未关闭 适合新手
#10,047 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
csharp
领域
backend, testing

调研方向

先查看 StepBaseOptimizationStrategy.Estimate 和 OptimizationStepParameterEnumerator,然后在优化测试套件中找到它们现有的单元测试。比较估算值与根据报告的最小值、最大值和步长生成的参数集数量,并添加回归断言。估算值与枚举出的数量一致(包括 issue 中的浮点数示例)即表示完成。

由索引模型根据 Issue 内容生成。

描述

Problem

StepBaseOptimizationStrategy.Estimate counts a step parameter's values as

(int)Math.Floor((MaxValue - MinValue) / Step.Value) + 1

while OptimizationStepParameterEnumerator walks MinValue + i * Step <= MaxValue. When the inputs are not exactly representable on the grid, the two can disagree, so GetTotalBacktestEstimate reports a different number of backtests from the number that run.

Seen in the cloud: min 0.10000000000000001, max 0.29999999999999999, step 0.050000000000000003 (float noise from the API, fixed separately in the API repo) gives an estimate of 4 values for a 0.1..0.3 / 0.05 parameter. With a second parameter at 5 values, the wizard showed 20 backtests for a 25-backtest grid.

Expected

Estimate returns the same count the enumerator produces for any min / max / step. For example, compute the count the same way the enumerator does, or round the quotient to a tolerance before Floor. Add a unit test with values like the ones above that asserts the estimate equals the number of enumerated parameter sets.

主要语言
C#
星标
22.4k
派生
5.4k
平均合并
1 天 22 小时
30 天内合并 PR
55

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

QuantConnect/Lean 的其他 Issue

查看 QuantConnect/Lean 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。