Changeset 18208
- Timestamp:
- 01/24/22 21:45:48 (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs
r18051 r18208 453 453 } 454 454 455 private Task<DoubleLimit> UpdateAllSeriesDataAsync(CancellationToken cancellationToken) { 456 var updateTasks = solutions.Select(solution => UpdateSeriesDataAsync(solution, cancellationToken)); 457 458 return Task.Run(() => { 459 double min = double.MaxValue, max = double.MinValue; 460 foreach (var update in updateTasks) { 461 var limit = update.Result; 462 if (limit.Lower < min) min = limit.Lower; 463 if (limit.Upper > max) max = limit.Upper; 464 } 465 466 return new DoubleLimit(min, max); 467 }, cancellationToken); 455 private async Task<DoubleLimit> UpdateAllSeriesDataAsync(CancellationToken cancellationToken) { 456 var updateTasks = solutions.Select(solution => UpdateSeriesDataAsync(solution, cancellationToken)).ToArray(); 457 458 double min = double.MaxValue, max = double.MinValue; 459 foreach (var update in updateTasks) { 460 var limit = await update; 461 if (limit.Lower < min) min = limit.Lower; 462 if (limit.Upper > max) max = limit.Upper; 463 } 464 465 return new DoubleLimit(min, max); 468 466 } 469 467 -
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs
r18051 r18208 239 239 } 240 240 241 public async Task AddSolution (IRegressionSolution solution) {241 public async Task AddSolutionAsync(IRegressionSolution solution) { 242 242 foreach (var chart in partialDependencePlots.Values) { 243 243 await chart.AddSolutionAsync(solution); -
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.Designer.cs
r18052 r18208 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.mainPanel = new System.Windows.Forms.Panel(); 27 this.SuspendLayout(); 28 // 29 // mainPanel 30 // 31 this.mainPanel.Dock = System.Windows.Forms.DockStyle.Fill; 32 this.mainPanel.Location = new System.Drawing.Point(0, 0); 33 this.mainPanel.Name = "mainPanel"; 34 this.mainPanel.Size = new System.Drawing.Size(490, 246); 35 this.mainPanel.TabIndex = 0; 36 // 37 // RunCollectionPartialDependencePlotView 38 // 39 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 40 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 41 this.Controls.Add(this.mainPanel); 42 this.Name = "RunCollectionPartialDependencePlotView"; 43 this.Size = new System.Drawing.Size(490, 246); 44 this.ResumeLayout(false); 26 this.tabControl = new System.Windows.Forms.TabControl(); 27 this.SuspendLayout(); 28 // 29 // tabControl1 30 // 31 this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; 32 this.tabControl.Location = new System.Drawing.Point(0, 0); 33 this.tabControl.Name = "tabControl1"; 34 this.tabControl.SelectedIndex = 0; 35 this.tabControl.Size = new System.Drawing.Size(490, 246); 36 this.tabControl.TabIndex = 0; 37 // 38 // RunCollectionPartialDependencePlotView 39 // 40 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 41 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 42 this.Controls.Add(this.tabControl); 43 this.Name = "RunCollectionPartialDependencePlotView"; 44 this.Size = new System.Drawing.Size(490, 246); 45 this.ResumeLayout(false); 45 46 46 47 } … … 48 49 #endregion 49 50 50 private System.Windows.Forms. Panel mainPanel;51 private System.Windows.Forms.TabControl tabControl; 51 52 } 52 53 } -
trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.cs
r18052 r18208 1 1 using System.Collections.Generic; 2 2 using System.Linq; 3 using System.Threading.Tasks; 3 4 using System.Windows.Forms; 4 5 using HeuristicLab.MainForm; … … 20 21 } 21 22 22 private static async void AddSolution(RegressionSolutionPartialDependencePlotView plot, IEnumerable<IRegressionSolution> solutions) { 23 foreach(var sol in solutions) { 24 await plot.AddSolution(sol); 23 protected override async void OnContentChanged() { 24 base.OnContentChanged(); 25 if (Content == null) { 26 tabControl.TabPages.Clear(); 27 return; 25 28 } 26 } 29 // distinct names of results of types IRegressionSolution 30 var solutionResultNames = Content.SelectMany(run => run.Results.Where(kvp => kvp.Value is IRegressionSolution).Select(kvp => kvp.Key)).Distinct().ToArray(); 27 31 28 protected override void OnContentChanged() { 29 base.OnContentChanged(); 32 foreach (var resultName in solutionResultNames) { 33 var tabPage = new TabPage(resultName); 34 tabControl.TabPages.Add(tabPage); 30 35 31 if (Content == null) return; 36 var solutions = new List<IRegressionSolution>(); 37 foreach (var run in Content) { 38 // in experiments we may mix algorithms and therefore have different solution names in different runs 39 // we only combine solutions with the same name 40 if (run.Results.TryGetValue(resultName, out var sol) && sol is IRegressionSolution) { 41 solutions.Add((IRegressionSolution)sol); 42 } 43 } 44 var plot = new RegressionSolutionPartialDependencePlotView { 45 Content = solutions[0], 46 Dock = DockStyle.Fill 47 }; 32 48 33 var solutions = Content.Select(run => (IRegressionSolution)run.Results["Best training solution"]).ToList(); 34 var plot = new RegressionSolutionPartialDependencePlotView { 35 Content = solutions[0], 36 Dock = DockStyle.Fill 37 }; 38 39 mainPanel.Controls.Add(plot); 40 AddSolution(plot, solutions); 49 tabPage.Controls.Add(plot); 50 for (int i = 1; i < solutions.Count; i++) 51 await plot.AddSolutionAsync(solutions[i]); 52 } 41 53 } 42 54 } -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/DatasetUtil.cs
r17180 r18208 97 97 98 98 foreach (var variable in dataset.VariableNames) { 99 IEnumerable<double> values = null; 100 99 IEnumerable<double> values; 101 100 if (rows == null) values = dataset.GetDoubleValues(variable); 102 101 else values = dataset.GetDoubleValues(variable, rows);
Note: See TracChangeset
for help on using the changeset viewer.