Last change
on this file since 18054 was
18052,
checked in by chaider, 3 years ago
|
#3134 Moved RunCollectionPartialDependencePlotView to DataAnalysis.Views
|
File size:
1.4 KB
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Linq;
|
---|
3 | using System.Windows.Forms;
|
---|
4 | using HeuristicLab.MainForm;
|
---|
5 | using HeuristicLab.MainForm.WindowsForms;
|
---|
6 | using HeuristicLab.Optimization;
|
---|
7 | using HeuristicLab.Problems.DataAnalysis.Views;
|
---|
8 |
|
---|
9 | namespace 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.