Changeset 18216 for branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.cs
- Timestamp:
- 02/10/22 19:48:12 (3 years ago)
- Location:
- branches/3136_Structural_GP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3136_Structural_GP
- Property svn:mergeinfo changed
/trunk merged: 18203,18208-18211
- Property svn:mergeinfo changed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Views merged: 18208-18210
- Property svn:mergeinfo changed
-
branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.cs
r18052 r18216 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 }
Note: See TracChangeset
for help on using the changeset viewer.