Changeset 14166


Ignore:
Timestamp:
07/21/16 17:24:22 (15 months ago)
Author:
mkommend
Message:

#2597: Merged r14095, r14096, r14098, r14099, r14118, r14119, r14131, r14157, r14158 into stable.

Location:
stable
Files:
6 deleted
21 edited
13 copied

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Algorithms.DataAnalysis

  • stable/HeuristicLab.Algorithms.DataAnalysis.Views

  • stable/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/HeuristicLab.Algorithms.DataAnalysis.Views-3.4.csproj

    r13951 r14166  
    125125  </ItemGroup>
    126126  <ItemGroup>
    127     <Compile Include="GaussianProcessRegressionSolutionEstimatedValuesView.cs">
    128       <SubType>UserControl</SubType>
    129     </Compile>
    130     <Compile Include="GaussianProcessRegressionSolutionEstimatedValuesView.Designer.cs">
    131       <DependentUpon>GaussianProcessRegressionSolutionEstimatedValuesView.cs</DependentUpon>
    132     </Compile>
    133127    <Compile Include="MeanProdView.cs">
    134128      <SubType>UserControl</SubType>
     
    180174    </Compile>
    181175    <Compile Include="Plugin.cs" />
    182     <Compile Include="GaussianProcessRegressionSolutionLineChartView.cs">
    183       <SubType>UserControl</SubType>
    184     </Compile>
    185     <Compile Include="GaussianProcessRegressionSolutionLineChartView.Designer.cs">
    186       <DependentUpon>GaussianProcessRegressionSolutionLineChartView.cs</DependentUpon>
    187     </Compile>
    188176    <Compile Include="SupportVectorMachineModelSupportVectorsView.cs">
    189177      <SubType>UserControl</SubType>
  • stable/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/Plugin.cs.frame

    r13316 r14166  
    4444  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    4545  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Views", "3.4")]
    46   [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")]
    4746  public class HeuristicLabAlgorithmsDataAnalysisViewsPlugin : PluginBase {
    4847  }
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r14027 r14166  
    341341    }
    342342
    343     public IEnumerable<double> GetEstimatedVariance(IDataset dataset, IEnumerable<int> rows) {
     343    public IEnumerable<double> GetEstimatedVariances(IDataset dataset, IEnumerable<int> rows) {
    344344      try {
    345345        if (x == null) {
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegressionSolution.cs

    r12009 r14166  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    23 using System.Linq;
    2422using HeuristicLab.Common;
    2523using HeuristicLab.Core;
     
    3331  [Item("GaussianProcessRegressionSolution", "Represents a Gaussian process solution for a regression problem which can be visualized in the GUI.")]
    3432  [StorableClass]
    35   public sealed class GaussianProcessRegressionSolution : RegressionSolution, IGaussianProcessSolution {
    36     private new readonly Dictionary<int, double> evaluationCache;
     33  public sealed class GaussianProcessRegressionSolution : ConfidenceRegressionSolution, IGaussianProcessSolution {
    3734
    3835    public new IGaussianProcessModel Model {
     
    4441    private GaussianProcessRegressionSolution(bool deserializing)
    4542      : base(deserializing) {
    46       evaluationCache = new Dictionary<int, double>();
    47 
    4843    }
    4944    private GaussianProcessRegressionSolution(GaussianProcessRegressionSolution original, Cloner cloner)
    50       : base(original, cloner) {
    51       evaluationCache = new Dictionary<int, double>(original.evaluationCache);
    52     }
     45      : base(original, cloner) { }
    5346    public GaussianProcessRegressionSolution(IGaussianProcessModel model, IRegressionProblemData problemData)
    54       : base(model, problemData) {
    55 
    56       evaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows);
    57     }
     47      : base(model, problemData) { }
    5848
    5949    public override IDeepCloneable Clone(Cloner cloner) {
    6050      return new GaussianProcessRegressionSolution(this, cloner);
    6151    }
    62 
    63     public IEnumerable<double> EstimatedVariance {
    64       get { return GetEstimatedVariance(Enumerable.Range(0, ProblemData.Dataset.Rows)); }
    65     }
    66     public IEnumerable<double> EstimatedTrainingVariance {
    67       get { return GetEstimatedVariance(ProblemData.TrainingIndices); }
    68     }
    69     public IEnumerable<double> EstimatedTestVariance {
    70       get { return GetEstimatedVariance(ProblemData.TestIndices); }
    71     }
    72 
    73     public IEnumerable<double> GetEstimatedVariance(IEnumerable<int> rows) {
    74       var rowsToEvaluate = rows.Except(evaluationCache.Keys);
    75       var rowsEnumerator = rowsToEvaluate.GetEnumerator();
    76       var valuesEnumerator = Model.GetEstimatedVariance(ProblemData.Dataset, rowsToEvaluate).GetEnumerator();
    77 
    78       while (rowsEnumerator.MoveNext() & valuesEnumerator.MoveNext()) {
    79         evaluationCache.Add(rowsEnumerator.Current, valuesEnumerator.Current);
    80       }
    81 
    82       return rows.Select(row => evaluationCache[row]);
    83     }
    84 
    85     protected override void OnModelChanged() {
    86       evaluationCache.Clear();
    87       base.OnModelChanged();
    88     }
    89     protected override void OnProblemDataChanged() {
    90       evaluationCache.Clear();
    91       base.OnProblemDataChanged();
    92     }
    9352  }
    9453}
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs

    r14027 r14166  
    2222
    2323using System;
    24 using System.Collections;
    2524using System.Collections.Generic;
    2625using System.Diagnostics;
     
    129128
    130129      // y and curPred are changed in gradient boosting
    131       this.y = y; 
    132       this.curPred = curPred; 
     130      this.y = y;
     131      this.curPred = curPred;
    133132
    134133      // shuffle row idx
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessModel.cs

    r12702 r14166  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using HeuristicLab.Problems.DataAnalysis;
    2423
     
    2726  /// Interface to represent a Gaussian process posterior
    2827  /// </summary>
    29   public interface IGaussianProcessModel : IRegressionModel {
     28  public interface IGaussianProcessModel : IConfidenceRegressionModel {
    3029    double NegativeLogLikelihood { get; }
    3130    double SigmaNoise { get; }
     
    3433    double[] HyperparameterGradients { get; }
    3534
    36     IEnumerable<double> GetEstimatedVariance(IDataset ds, IEnumerable<int> rows);
    3735    void FixParameters();
    3836  }
  • stable/HeuristicLab.Algorithms.DataAnalysis/3.4/Interfaces/IGaussianProcessSolution.cs

    r12009 r14166  
    2626  /// Interface to represent a Gaussian process solution (either regression or classification)
    2727  /// </summary>
    28   public interface IGaussianProcessSolution : IDataAnalysisSolution {
     28  public interface IGaussianProcessSolution : IConfidenceRegressionSolution {
    2929    new IGaussianProcessModel Model { get; }
    3030  }
  • stable/HeuristicLab.Problems.DataAnalysis

  • stable/HeuristicLab.Problems.DataAnalysis.Views

  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.Designer.cs

    r14099 r14166  
    3131      System.Windows.Forms.DataVisualization.Charting.StripLine stripLine2 = new System.Windows.Forms.DataVisualization.Charting.StripLine();
    3232      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
     33      System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
    3334      this.calculationPendingLabel = new System.Windows.Forms.Label();
    3435      this.calculationPendingTimer = new System.Windows.Forms.Timer(this.components);
     
    7475      chartArea1.Name = "ChartArea";
    7576      chartArea1.Position.Auto = false;
    76       chartArea1.Position.Height = 100F;
     77      chartArea1.Position.Height = 90F;
    7778      chartArea1.Position.Width = 100F;
     79      chartArea1.Position.Y = 10F;
    7880      this.chart.ChartAreas.Add(chartArea1);
    7981      this.chart.Dock = System.Windows.Forms.DockStyle.Fill;
     
    8890      this.chart.Size = new System.Drawing.Size(453, 308);
    8991      this.chart.TabIndex = 0;
     92      title1.Alignment = System.Drawing.ContentAlignment.TopCenter;
     93      title1.DockedToChartArea = "ChartArea";
     94      title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     95      title1.IsDockedInsideChartArea = false;
     96      title1.Name = "Title";
     97      title1.Text = "[Title]";
     98      this.chart.Titles.Add(title1);
    9099      this.chart.SelectionRangeChanged += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CursorEventArgs>(this.chart_SelectionRangeChanged);
     100      this.chart.PostPaint += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ChartPaintEventArgs>(this.chart_PostPaint);
     101      this.chart.AnnotationPositionChanged += new System.EventHandler(this.chart_AnnotationPositionChanged);
    91102      this.chart.AnnotationPositionChanging += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.AnnotationPositionChangingEventArgs>(this.chart_AnnotationPositionChanging);
    92103      this.chart.DragDrop += new System.Windows.Forms.DragEventHandler(this.chart_DragDrop);
    93104      this.chart.DragEnter += new System.Windows.Forms.DragEventHandler(this.chart_DragEnter);
    94105      this.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
     106      this.chart.Resize += new System.EventHandler(this.chart_Resize);
    95107      //
    96108      // configurationButton
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChart.cs

    r14099 r14166  
    6666      set {
    6767        chart.Annotations[0].Visible = value;
    68         if (!value) chart.ChartAreas[0].AxisX.Title = string.Empty;
     68        if (!value) chart.Titles[0].Text = string.Empty;
    6969      }
    7070    }
     
    207207    #endregion
    208208
     209    public event EventHandler ChartPostPaint;
     210
    209211    public GradientChart() {
    210212      InitializeComponent();
     
    266268          ciSeriesCache.Add(solution, series.Item2);
    267269      }
    268 
    269       ResizeAllSeriesData();
    270       OrderAndColorSeries();
    271     }
    272 
    273     public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {
    274       if (IsDisposed
    275         || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable)
    276         || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0)
    277         return;
    278 
    279       calculationPendingTimer.Start();
    280 
    281       Update(); // immediately show label
    282 
    283       // cancel previous recalculate call
    284       if (cancelCurrentRecalculateSource != null)
    285         cancelCurrentRecalculateSource.Cancel();
    286       cancelCurrentRecalculateSource = new CancellationTokenSource();
    287270
    288271      // Set cursor and x-axis
     
    300283
    301284      if (ShowCursor)
    302         chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
     285        chart.Titles[0].Text = FreeVariable + " : " + defaultValue.ToString("N3", CultureInfo.CurrentCulture);
     286
     287      ResizeAllSeriesData();
     288      OrderAndColorSeries();
     289    }
     290
     291    public async Task RecalculateAsync(bool updateOnFinish = true, bool resetYAxis = true) {
     292      if (IsDisposed
     293        || sharedFixedVariables == null || !solutions.Any() || string.IsNullOrEmpty(freeVariable)
     294        || trainingMin.IsAlmost(trainingMax) || trainingMin > trainingMax || drawingSteps == 0)
     295        return;
     296
     297      calculationPendingTimer.Start();
     298
     299      // cancel previous recalculate call
     300      if (cancelCurrentRecalculateSource != null)
     301        cancelCurrentRecalculateSource.Cancel();
     302      cancelCurrentRecalculateSource = new CancellationTokenSource();
     303      var cancellationToken = cancelCurrentRecalculateSource.Token;
    303304
    304305      // Update series
    305       var cancellationToken = cancelCurrentRecalculateSource.Token;
    306306      try {
    307307        var limits = await UpdateAllSeriesDataAsync(cancellationToken);
    308         //cancellationToken.ThrowIfCancellationRequested();
    309308
    310309        yMin = limits.Lower;
     
    328327    }
    329328
     329    public void UpdateTitlePosition() {
     330      var title = chart.Titles[0];
     331      var plotArea = InnerPlotPosition;
     332
     333      title.Visible = plotArea.Width != 0;
     334
     335      title.Position.X = plotArea.X + (plotArea.Width / 2);
     336    }
     337
    330338    private void SetupAxis(Axis axis, double minValue, double maxValue, int ticks, double? fixedAxisMin, double? fixedAxisMax) {
    331       double axisMin, axisMax, axisInterval;
    332       ChartUtil.CalculateAxisInterval(minValue, maxValue, ticks, out axisMin, out axisMax, out axisInterval);
    333       axis.Minimum = fixedAxisMin ?? axisMin;
    334       axis.Maximum = fixedAxisMax ?? axisMax;
    335       axis.Interval = (axis.Maximum - axis.Minimum) / ticks;
     339      if (minValue < maxValue) {
     340        double axisMin, axisMax, axisInterval;
     341        ChartUtil.CalculateAxisInterval(minValue, maxValue, ticks, out axisMin, out axisMax, out axisInterval);
     342        axis.Minimum = fixedAxisMin ?? axisMin;
     343        axis.Maximum = fixedAxisMax ?? axisMax;
     344        axis.Interval = (axis.Maximum - axis.Minimum) / ticks;
     345      }
    336346
    337347      try {
     
    453463          if (yvalues[i] > max) max = yvalues[i];
    454464        }
     465        chart.Invalidate();
     466
     467        cancellationToken.ThrowIfCancellationRequested();
    455468
    456469        var confidenceBoundSolution = solution as IConfidenceRegressionSolution;
    457470        if (confidenceBoundSolution != null) {
    458471          var confidenceIntervalSeries = ciSeriesCache[solution];
    459 
    460           cancellationToken.ThrowIfCancellationRequested();
    461           var variances =
    462             confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset,
    463               Enumerable.Range(0, internalDataset.Rows)).ToList();
     472          var variances = confidenceBoundSolution.Model.GetEstimatedVariances(internalDataset, Enumerable.Range(0, internalDataset.Rows)).ToList();
    464473          for (int i = 0; i < xvalues.Count; i++) {
    465474            var lower = yvalues[i] - 1.96 * Math.Sqrt(variances[i]);
     
    469478            if (upper > max) max = upper;
    470479          }
     480          chart.Invalidate();
    471481        }
    472482
     
    619629
    620630      e.NewLocationX = newLocation;
    621       var annotation = VerticalLineAnnotation;
    622       var x = annotation.X;
     631
     632      UpdateCursor();
     633    }
     634    private void chart_AnnotationPositionChanged(object sender, EventArgs e) {
     635      UpdateCursor();
     636    }
     637    void UpdateCursor() {
     638      var x = VerticalLineAnnotation.X;
    623639      sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
    624640
    625641      if (ShowCursor) {
    626         chart.ChartAreas[0].AxisX.Title = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
     642        chart.Titles[0].Text = FreeVariable + " : " + x.ToString("N3", CultureInfo.CurrentCulture);
    627643        chart.Update();
    628644      }
     
    636652    }
    637653
    638     private void chart_DragDrop(object sender, DragEventArgs e) {
     654    private async void chart_DragDrop(object sender, DragEventArgs e) {
    639655      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    640656      if (data != null) {
    641657        var solution = data as IRegressionSolution;
    642658        if (!solutions.Contains(solution))
    643           AddSolutionAsync(solution);
     659          await AddSolutionAsync(solution);
    644660      }
    645661    }
     
    667683      OnZoomChanged(this, EventArgs.Empty);
    668684    }
     685
     686    private void chart_Resize(object sender, EventArgs e) {
     687      UpdateTitlePosition();
     688    }
     689
     690    private void chart_PostPaint(object sender, ChartPaintEventArgs e) {
     691      if (ChartPostPaint != null)
     692        ChartPostPaint(this, EventArgs.Empty);
     693    }
    669694    #endregion
    670695  }
    671696}
     697
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/GradientChartConfigurationDialog.cs

    r14099 r14166  
    5151    private async void okButton_Click(object sender, System.EventArgs e) {
    5252      try {
     53        Enabled = false;
    5354        chart.SuspendRepaint();
    5455        if (xAutomaticCheckBox.Checked) {
     
    8283      }
    8384      finally {
     85        Enabled = true;
    8486        chart.ResumeRepaint(true);
    8587      }
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r14005 r14166  
    120120  </ItemGroup>
    121121  <ItemGroup>
     122    <Compile Include="Controls\DensityChart.cs">
     123      <SubType>UserControl</SubType>
     124    </Compile>
     125    <Compile Include="Controls\DensityChart.Designer.cs">
     126      <DependentUpon>DensityChart.cs</DependentUpon>
     127    </Compile>
     128    <Compile Include="Controls\DensityTrackbar.cs">
     129      <SubType>UserControl</SubType>
     130    </Compile>
     131    <Compile Include="Controls\DensityTrackbar.Designer.cs">
     132      <DependentUpon>DensityTrackbar.cs</DependentUpon>
     133    </Compile>
    122134    <Compile Include="FeatureCorrelation\TimeframeFeatureCorrelationCalculator.cs" />
    123135    <Compile Include="FeatureCorrelation\AbstractFeatureCorrelationCalculator.cs" />
     
    183195      <DependentUpon>FeatureCorrelationView.cs</DependentUpon>
    184196    </Compile>
     197    <Compile Include="Controls\GradientChart.cs">
     198      <SubType>UserControl</SubType>
     199    </Compile>
     200    <Compile Include="Controls\GradientChart.Designer.cs">
     201      <DependentUpon>GradientChart.cs</DependentUpon>
     202    </Compile>
     203    <Compile Include="Controls\GradientChartConfigurationDialog.cs">
     204      <SubType>Form</SubType>
     205    </Compile>
     206    <Compile Include="Controls\GradientChartConfigurationDialog.Designer.cs">
     207      <DependentUpon>GradientChartConfigurationDialog.cs</DependentUpon>
     208    </Compile>
    185209    <Compile Include="Interfaces\IDataPreprocessorStarter.cs" />
    186210    <Compile Include="MenuItems\ShrinkDataAnalysisRunsMenuItem.cs" />
     
    198222      <DependentUpon>ProblemDataView.cs</DependentUpon>
    199223    </Compile>
     224    <Compile Include="Regression\ConfidenceRegressionSolutionEstimatedValuesView.cs">
     225      <SubType>UserControl</SubType>
     226    </Compile>
     227    <Compile Include="Regression\ConfidenceRegressionSolutionEstimatedValuesView.Designer.cs">
     228      <DependentUpon>ConfidenceRegressionSolutionEstimatedValuesView.cs</DependentUpon>
     229    </Compile>
     230    <Compile Include="Regression\ConfidenceRegressionSolutionLineChartView.cs">
     231      <SubType>UserControl</SubType>
     232    </Compile>
     233    <Compile Include="Regression\ConfidenceRegressionSolutionLineChartView.Designer.cs">
     234      <DependentUpon>ConfidenceRegressionSolutionLineChartView.cs</DependentUpon>
     235    </Compile>
    200236    <Compile Include="Regression\RegressionEnsembleSolutionModelWeightsView.cs">
    201237      <SubType>UserControl</SubType>
     
    210246      <DependentUpon>RegressionFeatureCorrelationView.cs</DependentUpon>
    211247    </Compile>
     248    <Compile Include="Regression\RegressionSolutionGradientView.cs">
     249      <SubType>UserControl</SubType>
     250    </Compile>
     251    <Compile Include="Regression\RegressionSolutionGradientView.Designer.cs">
     252      <DependentUpon>RegressionSolutionGradientView.cs</DependentUpon>
     253    </Compile>
     254    <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.cs">
     255      <SubType>UserControl</SubType>
     256    </Compile>
     257    <Compile Include="Regression\RegressionSolutionTargetResponseGradientView.Designer.cs">
     258      <DependentUpon>RegressionSolutionTargetResponseGradientView.cs</DependentUpon>
     259    </Compile>
    212260    <Compile Include="Regression\RegressionTimeframeFeatureCorrelationView.cs">
    213261      <SubType>UserControl</SubType>
     
    318366      <DependentUpon>DataAnalysisSolutionView.cs</DependentUpon>
    319367    </Compile>
    320     <Compile Include="DoubleLimitView.cs">
    321       <SubType>UserControl</SubType>
    322     </Compile>
    323     <Compile Include="DoubleLimitView.Designer.cs">
     368    <Compile Include="Controls\DoubleLimitView.cs">
     369      <SubType>UserControl</SubType>
     370    </Compile>
     371    <Compile Include="Controls\DoubleLimitView.Designer.cs">
    324372      <DependentUpon>DoubleLimitView.cs</DependentUpon>
    325373    </Compile>
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionGradientView.cs

    r14096 r14166  
    162162    }
    163163
    164     private void trackbar_CheckedChanged(object sender, EventArgs e) {
     164    private async void trackbar_CheckedChanged(object sender, EventArgs e) {
    165165      var trackBar = sender as DensityTrackbar;
    166166      if (trackBar == null || !trackBar.Checked) return;
     
    169169        tb.Checked = false;
    170170      gradientChart.FreeVariable = variableNames[trackbars.IndexOf(trackBar)];
    171       gradientChart.RecalculateAsync();
    172     }
    173 
    174     private void trackbar_LimitsChanged(object sender, EventArgs e) {
     171      await gradientChart.RecalculateAsync();
     172    }
     173
     174    private async void trackbar_LimitsChanged(object sender, EventArgs e) {
    175175      var trackBar = sender as DensityTrackbar;
    176176      if (trackBar == null || !trackBar.Checked) return;
    177177      gradientChart.FixedXAxisMin = trackBar.Limits.Lower;
    178178      gradientChart.FixedXAxisMax = trackBar.Limits.Upper;
    179       gradientChart.RecalculateAsync();
    180     }
    181 
    182     private void trackbar_ValueChanged(object sender, EventArgs e) {
     179      await gradientChart.RecalculateAsync();
     180    }
     181
     182    private async void trackbar_ValueChanged(object sender, EventArgs e) {
    183183      var trackBar = sender as DensityTrackbar;
    184184      if (trackBar == null) return;
    185185      sharedFixedVariables.SetVariableValue((double)trackBar.Value, variableNames[trackbars.IndexOf(trackBar)], 0);
    186       gradientChart.RecalculateAsync();
     186      await gradientChart.RecalculateAsync();
    187187    }
    188188
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionTargetResponseGradientView.cs

    r14096 r14166  
    127127          Margin = Padding.Empty,
    128128          Height = 12,
    129           Visible = false
     129          Visible = false,
     130          Top = (int)(gradientChart.Height * 0.1),
    130131        };
    131132        densityCharts.Add(variableName, densityChart);
     
    138139            UpdateDensityChart(density, gradient.FreeVariable);
    139140        };
     141        gradientChart.SizeChanged += (o, e) => {
     142          var gradient = (GradientChart)o;
     143          var density = densityCharts[gradient.FreeVariable];
     144          density.Top = (int)(gradient.Height * 0.1);
     145        };
     146
     147        // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
     148        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
     149        gradientChart.ChartPostPaint += OnGradientChartOnChartPostPaint;
    140150
    141151        var panel = new Panel() {
     
    161171
    162172      RecalculateAndRelayoutCharts();
     173    }
     174
     175    private void OnGradientChartOnChartPostPaint(object o, EventArgs e) {
     176      var gradient = (GradientChart)o;
     177      var density = densityCharts[gradient.FreeVariable];
     178
     179      density.Width = gradient.Width;
     180
     181      var gcPlotPosition = gradient.InnerPlotPosition;
     182      density.Left = (int)(gcPlotPosition.X / 100.0 * gradient.Width);
     183      density.Width = (int)(gcPlotPosition.Width / 100.0 * gradient.Width);
     184      gradient.UpdateTitlePosition();
     185
     186      // removed after succesful layouting due to performance reasons
     187      if (gcPlotPosition.Width != 0)
     188        gradient.ChartPostPaint -= OnGradientChartOnChartPostPaint;
    163189    }
    164190
     
    372398        densityChart.Visible = true;
    373399      }
     400
     401      gradientChart.UpdateTitlePosition();
    374402    }
    375403
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r14022 r14166  
    3131
    3232namespace HeuristicLab.Problems.DataAnalysis.Views {
    33   [View("RegressionSolution View")]
     33  [View("Solution View")]
    3434  [Content(typeof(RegressionSolutionBase), false)]
    3535  public partial class RegressionSolutionView : DataAnalysisSolutionView {
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r14027 r14166  
    138138    <Compile Include="Implementation\ConstantModel.cs" />
    139139    <Compile Include="Implementation\DataAnalysisModel.cs" />
     140    <Compile Include="Implementation\Regression\ConfidenceBoundRegressionSolution.cs" />
    140141    <Compile Include="Implementation\Regression\ConstantRegressionModel.cs" />
    141142    <Compile Include="Implementation\Regression\ConstantRegressionSolution.cs" />
     
    175176    <Compile Include="Interfaces\ITransformation.cs" />
    176177    <Compile Include="Interfaces\ITransformationMapper.cs" />
     178    <Compile Include="Interfaces\Regression\IConfidenceRegressionModel.cs" />
     179    <Compile Include="Interfaces\Regression\IConfidenceRegressionSolution.cs" />
    177180    <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs">
    178181      <SubType>Code</SubType>
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConfidenceBoundRegressionSolution.cs

    r14096 r14166  
    3030  /// </summary>
    3131  [StorableClass]
    32   public class ConfidenceBoundRegressionSolution : RegressionSolution, IConfidenceBoundRegressionSolution {
     32  public class ConfidenceRegressionSolution : RegressionSolution, IConfidenceRegressionSolution {
    3333    protected readonly Dictionary<int, double> varianceEvaluationCache;
    3434
    35     public new IConfidenceBoundRegressionModel Model {
    36       get { return (IConfidenceBoundRegressionModel)base.Model; }
     35    public new IConfidenceRegressionModel Model {
     36      get { return (IConfidenceRegressionModel)base.Model; }
    3737      set { base.Model = value; }
    3838    }
    3939
    4040    [StorableConstructor]
    41     protected ConfidenceBoundRegressionSolution(bool deserializing)
     41    protected ConfidenceRegressionSolution(bool deserializing)
    4242      : base(deserializing) {
    4343      varianceEvaluationCache = new Dictionary<int, double>();
    4444    }
    45     protected ConfidenceBoundRegressionSolution(ConfidenceBoundRegressionSolution original, Cloner cloner)
     45    protected ConfidenceRegressionSolution(ConfidenceRegressionSolution original, Cloner cloner)
    4646      : base(original, cloner) {
    4747      varianceEvaluationCache = new Dictionary<int, double>(original.varianceEvaluationCache);
    4848    }
    49     public ConfidenceBoundRegressionSolution(IConfidenceBoundRegressionModel model, IRegressionProblemData problemData)
     49    public ConfidenceRegressionSolution(IConfidenceRegressionModel model, IRegressionProblemData problemData)
    5050      : base(model, problemData) {
    5151      varianceEvaluationCache = new Dictionary<int, double>(problemData.Dataset.Rows);
     
    5353
    5454    public override IDeepCloneable Clone(Cloner cloner) {
    55       return new ConfidenceBoundRegressionSolution(this, cloner);
     55      return new ConfidenceRegressionSolution(this, cloner);
    5656    }
    5757
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionModel.cs

    r14027 r14166  
    2121
    2222using System.Collections.Generic;
     23
    2324namespace HeuristicLab.Problems.DataAnalysis {
    2425  public interface IRegressionModel : IDataAnalysisModel {
  • stable/HeuristicLab.Tests

  • stable/HeuristicLab.Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/GaussianProcessModelTest.cs

    r12009 r14166  
    6666        Assert.AreEqual(347.9993, predTrain[1], 1e-3);
    6767
    68         var predTrainVar = model.GetEstimatedVariance(problemData.Dataset, problemData.TrainingIndices).ToArray();
     68        var predTrainVar = model.GetEstimatedVariances(problemData.Dataset, problemData.TrainingIndices).ToArray();
    6969      }
    7070
Note: See TracChangeset for help on using the changeset viewer.