Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionPartialDependencePlotView.cs @ 18051

Last change on this file since 18051 was 18051, checked in by chaider, 3 years ago

#3134 Added RunCollectionPartialDependencePlotView and changed UpdateAllSeriesDataAsync method in PartialDependencePlot to await all updates from the given enumeration

File size: 1.4 KB
RevLine 
[18051]1using System.Collections.Generic;
2using System.Linq;
3using System.Windows.Forms;
4using HeuristicLab.MainForm;
5using HeuristicLab.MainForm.WindowsForms;
6using HeuristicLab.Optimization;
7using HeuristicLab.Problems.DataAnalysis.Views;
8
9namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
10  [Content(typeof(RunCollection), false)]
11  [View("RunCollection Partial Dependence Plots")]
12  public partial class RunCollectionPartialDependencePlotView : AsynchronousContentView {
13    public new RunCollection Content {
14      get => (RunCollection)base.Content;
15      set => base.Content = value;
16    }
17
18    public RunCollectionPartialDependencePlotView() {
19      InitializeComponent();
20    }
21
22    private static async void AddSolution(RegressionSolutionPartialDependencePlotView plot, IEnumerable<IRegressionSolution> solutions) {
23      foreach(var sol in solutions) {
24        await plot.AddSolution(sol);
25      }
26    }
27
28    protected override void OnContentChanged() {
29      base.OnContentChanged();
30
31      if (Content == null) return;
32
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);
41    }
42  }
43}
Note: See TracBrowser for help on using the repository browser.