Free cookie consent management tool by TermsFeed Policy Generator

Changeset 18208


Ignore:
Timestamp:
01/24/22 21:45:48 (13 months ago)
Author:
gkronber
Message:

#3134: bugfixes and improvements

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs

    r18051 r18208  
    453453    }
    454454
    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);
    468466    }
    469467
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r18051 r18208  
    239239    }
    240240
    241     public async Task AddSolution(IRegressionSolution solution) {
     241    public async Task AddSolutionAsync(IRegressionSolution solution) {
    242242      foreach (var chart in partialDependencePlots.Values) {
    243243        await chart.AddSolutionAsync(solution);
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.Designer.cs

    r18052 r18208  
    2424    /// </summary>
    2525    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);
    4546
    4647    }
     
    4849    #endregion
    4950
    50     private System.Windows.Forms.Panel mainPanel;
     51    private System.Windows.Forms.TabControl tabControl;
    5152  }
    5253}
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RunCollectionPartialDependencePlotView.cs

    r18052 r18208  
    11using System.Collections.Generic;
    22using System.Linq;
     3using System.Threading.Tasks;
    34using System.Windows.Forms;
    45using HeuristicLab.MainForm;
     
    2021    }
    2122
    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;
    2528      }
    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();
    2731
    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);
    3035
    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        };
    3248
    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      }
    4153    }
    4254  }
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/DatasetUtil.cs

    r17180 r18208  
    9797
    9898      foreach (var variable in dataset.VariableNames) {
    99         IEnumerable<double> values = null;
    100 
     99        IEnumerable<double> values;
    101100        if (rows == null) values = dataset.GetDoubleValues(variable);
    102101        else values = dataset.GetDoubleValues(variable, rows);
Note: See TracChangeset for help on using the changeset viewer.