Optimization analysis fails on parameter points revisited by Euler search
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 54/100
調査の方向性
Start in Optimizer/Analysis/OptimizationModes.cs at the ToDictionary call in OptimizationModes.Find, then read the analysis flow through OptimizationAnalyzer.Run and LeanOptimizer.TriggerOnEndEvent. Add coverage for duplicate coordinates and overlapping Euler passes, including repeated coordinates with different metrics; done means successful final analysis with the chosen representation policy explicit in tests.
索引モデルが issue の本文から書いたものです。
説明
Problem
The final optimization analysis throws when multiple backtests have the same parameter coordinates. Euler search legitimately revisits points from its coarse pass during refinement, so a completed Euler optimization can lose its aggregate analysis even when every backtest succeeds.
OptimizationModes.Find builds a dictionary of grid coordinates using indexed.ToDictionary(...) in Optimizer/Analysis/OptimizationModes.cs:66. Repeated coordinates cause ArgumentException. LeanOptimizer.TriggerOnEndEvent catches the exception and completes the optimization, but the final analysis is not assigned.
This is existing behavior on master; it does not require automatically calculated steps.
Minimal reproduction
using System.Collections.Generic;
using QuantConnect.Optimizer;
using QuantConnect.Optimizer.Analysis;
using QuantConnect.Optimizer.Parameters;
using QuantConnect.Statistics;
var backtests = new List<OptimizationBacktestMetrics>
{
new()
{
BacktestId = "coarse",
Parameters = new Dictionary<string, decimal> { ["x"] = 1m },
SharpeRatio = 1m,
TotalPerformance = new AlgorithmPerformance()
},
new()
{
BacktestId = "refined",
Parameters = new Dictionary<string, decimal> { ["x"] = 1m },
SharpeRatio = 1m,
TotalPerformance = new AlgorithmPerformance()
}
};
var parameters = new HashSet<OptimizationParameter>
{
new OptimizationStepParameter("x", 1m, 2m, 1m)
};
new OptimizationAnalyzer().Run(
new OptimizationAnalysisRunParameters(backtests, parameters));
Observed:
System.ArgumentException: An item with the same key has already been added. Key: 0
at QuantConnect.Optimizer.Analysis.OptimizationModes.Find(...)
at QuantConnect.Optimizer.Analysis.OptimizationAnalyzer.Run(...)
Also reproduced end to end with ParameterizedAlgorithm: Euler search with ema-fast 10..30, step 10, minimum step 5, and ema-slow fixed at 50 produces a three-backtest coarse pass followed by five refined backtests. All eight backtests complete successfully. The repeated points (10,50), (20,50), and (30,50) then trigger the duplicate-key error during final analysis.
Expected behavior
Repeated parameter coordinates must not prevent analysis of an otherwise successful optimization. Define how repeated observations are represented when finding modes, and add coverage for duplicate coordinates and overlapping Euler passes. Any aggregation or representative-selection policy should be explicit and tested, including repeated coordinates with different metrics.
- 主要言語
- C#
- スター
- 22.6k
- フォーク
- 5.4k
- 平均マージ
- 11時間 39分
- マージ済み PR(30日)
- 104
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
QuantConnect/Lean のほかの issue
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
QuantConnect/Lean#10216 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuantConnect/Lean#10206 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
QuantConnect/Lean#10199 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
QuantConnect/Lean#10198 ·
メンテナーはふだん 1 日以内に返信
-
priority:p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
QuantConnect/Lean#10197 ·
メンテナーはふだん 1 日以内に返信
QuantConnect/Lean の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
dotnet-outdated/dotnet-outdated#871 ·
メンテナーはふだん 1 日以内に返信
-
triage/untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unoplatform/uno#26676 ·
メンテナーはふだん 1 日以内に返信
-
.NET bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
jhaizhou-ops/S2Arm#2177 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
area-CodeGen-coreclr untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dotnet/runtime#138181 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信