Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15161 for stable


Ignore:
Timestamp:
07/06/17 14:31:05 (7 years ago)
Author:
gkronber
Message:

#2779: merged r14889,r14890,r14943,r15024,r15088,r15094 from trunk to stable

Location:
stable
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.Designer.cs

    r14186 r15161  
    139139      this.xAxisComboBox.Size = new System.Drawing.Size(400, 21);
    140140      this.xAxisComboBox.TabIndex = 7;
     141      this.xAxisComboBox.Sorted = false;
    141142      this.xAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
    142143      //
     
    160161      this.yAxisComboBox.Size = new System.Drawing.Size(400, 21);
    161162      this.yAxisComboBox.TabIndex = 5;
     163      this.yAxisComboBox.Sorted = false;
    162164      this.yAxisComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
    163165      //
     
    183185      this.sizeComboBox.Name = "sizeComboBox";
    184186      this.sizeComboBox.Size = new System.Drawing.Size(300, 21);
     187      this.sizeComboBox.Sorted = false;
    185188      this.sizeComboBox.TabIndex = 14;
    186189      this.sizeComboBox.SelectedValueChanged += new System.EventHandler(this.AxisComboBox_SelectedValueChanged);
     
    264267      this.radioButtonGroup.Controls.Add(this.zoomButton);
    265268      this.radioButtonGroup.Controls.Add(this.selectButton);
    266       this.radioButtonGroup.Location = new System.Drawing.Point(3, 704);
     269      this.radioButtonGroup.Location = new System.Drawing.Point(6, 679);
    267270      this.radioButtonGroup.Name = "radioButtonGroup";
    268271      this.radioButtonGroup.Size = new System.Drawing.Size(122, 32);
     
    275278      this.colorRunsButton.Enabled = false;
    276279      this.colorRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    277       this.colorRunsButton.Location = new System.Drawing.Point(131, 713);
     280      this.colorRunsButton.Location = new System.Drawing.Point(6, 715);
    278281      this.colorRunsButton.Name = "colorRunsButton";
    279282      this.colorRunsButton.Size = new System.Drawing.Size(21, 21);
     
    317320      this.transparencyTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    318321      this.transparencyTrackBar.LargeChange = 16;
    319       this.transparencyTrackBar.Location = new System.Drawing.Point(302, 715);
     322      this.transparencyTrackBar.Location = new System.Drawing.Point(177, 717);
    320323      this.transparencyTrackBar.Maximum = 254;
    321324      this.transparencyTrackBar.Name = "transparencyTrackBar";
     
    331334      this.hideRunsButton.Enabled = false;
    332335      this.hideRunsButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    333       this.hideRunsButton.Location = new System.Drawing.Point(172, 713);
     336      this.hideRunsButton.Location = new System.Drawing.Point(47, 715);
    334337      this.hideRunsButton.Name = "hideRunsButton";
    335338      this.hideRunsButton.Size = new System.Drawing.Size(43, 21);
     
    347350      this.colorDialogButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 6.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
    348351      this.colorDialogButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
    349       this.colorDialogButton.Location = new System.Drawing.Point(152, 713);
     352      this.colorDialogButton.Location = new System.Drawing.Point(27, 715);
    350353      this.colorDialogButton.Name = "colorDialogButton";
    351354      this.colorDialogButton.Size = new System.Drawing.Size(14, 21);
     
    390393      this.transparencyLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    391394      this.transparencyLabel.AutoSize = true;
    392       this.transparencyLabel.Location = new System.Drawing.Point(233, 717);
     395      this.transparencyLabel.Location = new System.Drawing.Point(108, 719);
    393396      this.transparencyLabel.Name = "transparencyLabel";
    394397      this.transparencyLabel.Size = new System.Drawing.Size(75, 13);
  • stable/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionBubbleChartView.cs

    r15154 r15161  
    9393    }
    9494
     95    public string SelectedXAxis {
     96      get { return xAxisValue; }
     97      set {
     98        if (xAxisComboBox.Items.Contains(value)) {
     99          xAxisComboBox.SelectedItem = value;
     100        }
     101      }
     102    }
     103    public string SelectedYAxis {
     104      get { return yAxisValue; }
     105      set {
     106        if (yAxisComboBox.Items.Contains(value)) {
     107          yAxisComboBox.SelectedItem = value;
     108        }
     109      }
     110    }
     111
    95112    protected override void RegisterContentEvents() {
    96113      base.RegisterContentEvents();
     
    227244        string[] additionalAxisDimension = Enum.GetNames(typeof(AxisDimension));
    228245        this.xAxisComboBox.Items.AddRange(additionalAxisDimension);
    229         this.xAxisComboBox.Items.AddRange(Matrix.ColumnNames.ToArray());
     246        var comparer = new HeuristicLab.Common.NaturalStringComparer();
     247        var sortedColumnNames = Matrix.ColumnNames.ToArray();
     248        sortedColumnNames.StableSort(comparer);
     249        this.xAxisComboBox.Items.AddRange(sortedColumnNames);
    230250        this.yAxisComboBox.Items.AddRange(additionalAxisDimension);
    231         this.yAxisComboBox.Items.AddRange(Matrix.ColumnNames.ToArray());
     251        this.yAxisComboBox.Items.AddRange(sortedColumnNames);
    232252        string[] additionalSizeDimension = Enum.GetNames(typeof(SizeDimension));
    233253        this.sizeComboBox.Items.AddRange(additionalSizeDimension);
    234         this.sizeComboBox.Items.AddRange(Matrix.ColumnNames.ToArray());
     254        this.sizeComboBox.Items.AddRange(sortedColumnNames);
    235255        this.sizeComboBox.SelectedItem = SizeDimension.Constant.ToString();
    236256
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r15137 r15161  
    271271    <Compile Include="Regression\RegressionSolutionResidualsLineChartView.Designer.cs">
    272272      <DependentUpon>RegressionSolutionResidualsLineChartView.cs</DependentUpon>
     273    </Compile>
     274    <Compile Include="Regression\RegressionSolutionResidualAnalysisView.cs">
     275      <SubType>UserControl</SubType>
     276    </Compile>
     277    <Compile Include="Regression\RegressionSolutionResidualAnalysisView.Designer.cs">
     278      <DependentUpon>RegressionSolutionResidualAnalysisView.cs</DependentUpon>
    273279    </Compile>
    274280    <Compile Include="Regression\RegressionSolutionVariableImpactsView.cs">
  • stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualAnalysisView.cs

    r14890 r15161  
    2020#endregion
    2121using System;
     22using System.Collections.Generic;
    2223using System.Drawing;
    2324using System.Linq;
    24 using System.Runtime.Remoting.Contexts;
    25 using System.Threading.Tasks;
    2625using HeuristicLab.Data;
    2726using HeuristicLab.MainForm;
     
    3130  [View("Residual Analysis")]
    3231  [Content(typeof(IRegressionSolution))]
    33   public partial class RegressionSolutionResidualAnalysisView : DataAnalysisSolutionEvaluationView {
     32  public sealed partial class RegressionSolutionResidualAnalysisView : DataAnalysisSolutionEvaluationView {
     33
     34    // names should be relatively save to prevent collisions with variable names in the dataset
     35    private const string TargetLabel = "> Target";
     36    private const string PredictionLabel = "> Prediction";
     37    private const string ResidualLabel = "> Residual";
     38    private const string AbsResidualLabel = "> Residual (abs.)";
     39    private const string RelativeErrorLabel = "> Relative Error";
     40    private const string AbsRelativeErrorLabel = "> Relative Error (abs.)";
     41    private const string PartitionLabel = "> Partition";
    3442
    3543    public new IRegressionSolution Content {
    3644      get { return (IRegressionSolution)base.Content; }
    37       set {
    38         base.Content = value;
    39       }
     45      set { base.Content = value; }
    4046    }
    4147
    42     public RegressionSolutionResidualAnalysisView()
    43       : base() {
     48    public RegressionSolutionResidualAnalysisView() : base() {
    4449      InitializeComponent();
    4550    }
     
    5863    }
    5964
    60     protected virtual void Content_ProblemDataChanged(object sender, EventArgs e) {
     65    private void Content_ProblemDataChanged(object sender, EventArgs e) {
    6166      OnContentChanged();
    6267    }
    6368
    64     protected virtual void Content_ModelChanged(object sender, EventArgs e) {
     69    private void Content_ModelChanged(object sender, EventArgs e) {
    6570      OnContentChanged();
    6671    }
     
    8388      var ds = problemData.Dataset;
    8489      var runs = new RunCollection();
     90      // determine relevant variables (at least two different values)
     91      var doubleVars = ds.DoubleVariables.Where(vn => ds.GetDoubleValues(vn).Max() > ds.GetDoubleValues(vn).Min()).ToArray();
     92      var stringVars = ds.StringVariables.Where(vn => ds.GetStringValues(vn).Distinct().Skip(1).Any()).ToArray();
     93      var dateTimeVars = ds.DateTimeVariables.Where(vn => ds.GetDateTimeValues(vn).Distinct().Skip(1).Any()).ToArray();
     94
    8595      // produce training and test values separately as they might overlap (e.g. for ensembles)
    8696      var predictedValuesTrain = Content.EstimatedTrainingValues.ToArray();
    8797      int j = 0; // idx for predictedValues array
    88       var partitionId = "Partition";
    89       while (ds.VariableNames.Contains(partitionId)) partitionId += "_";
    9098      foreach (var i in problemData.TrainingIndices) {
    91         var run = CreateRunForIdx(i, problemData);
     99        var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars);
    92100        var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i);
    93101        AddErrors(run, predictedValuesTrain[j++], targetValue);
    94         run.Results.Add(partitionId, new StringValue("Training"));
     102        run.Results.Add(PartitionLabel, new StringValue("Training"));
    95103        run.Color = Color.Gold;
    96104        runs.Add(run);
     
    99107      j = 0;
    100108      foreach (var i in problemData.TestIndices) {
    101         var run = CreateRunForIdx(i, problemData);
     109        var run = CreateRunForIdx(i, problemData, doubleVars, stringVars, dateTimeVars);
    102110        var targetValue = ds.GetDoubleValue(problemData.TargetVariable, i);
    103111        AddErrors(run, predictedValuesTest[j++], targetValue);
    104         run.Results.Add(partitionId, new StringValue("Test"));
     112        run.Results.Add(PartitionLabel, new StringValue("Test"));
    105113        run.Color = Color.Red;
    106114        runs.Add(run);
     
    119127      var residual = target - pred;
    120128      var relError = residual / target;
    121       var predId = "Prediction";
    122       while (run.Results.ContainsKey(predId)) predId += "_";
    123       var resId = "Residual";
    124       while (run.Results.ContainsKey(resId)) resId += "_";
    125       var relErrorId = "Rel. Error";
    126       while (run.Results.ContainsKey(relErrorId)) relErrorId+= "_";
    127       run.Results.Add(predId, new DoubleValue(pred));
    128       run.Results.Add(resId, new DoubleValue(residual));
    129       run.Results.Add(relErrorId, new DoubleValue(relError));
     129      run.Results.Add(TargetLabel, new DoubleValue(target));
     130      run.Results.Add(PredictionLabel, new DoubleValue(pred));
     131      run.Results.Add(ResidualLabel, new DoubleValue(residual));
     132      run.Results.Add(AbsResidualLabel, new DoubleValue(Math.Abs(residual)));
     133      run.Results.Add(RelativeErrorLabel, new DoubleValue(relError));
     134      run.Results.Add(AbsRelativeErrorLabel, new DoubleValue(Math.Abs(relError)));
    130135    }
    131136
    132     private IRun CreateRunForIdx(int i, IRegressionProblemData problemData) {
     137    private IRun CreateRunForIdx(int i, IRegressionProblemData problemData, IEnumerable<string> doubleVars, IEnumerable<string> stringVars, IEnumerable<string> dateTimeVars) {
    133138      var ds = problemData.Dataset;
    134139      var run = new Run();
    135       foreach (var variableName in ds.DoubleVariables) {
     140      foreach (var variableName in doubleVars) {
    136141        run.Results.Add(variableName, new DoubleValue(ds.GetDoubleValue(variableName, i)));
    137142      }
    138       foreach (var variableName in ds.StringVariables) {
     143      foreach (var variableName in stringVars) {
    139144        run.Results.Add(variableName, new StringValue(ds.GetStringValue(variableName, i)));
    140145      }
    141 
     146      foreach (var variableName in dateTimeVars) {
     147        run.Results.Add(variableName, new DateTimeValue(ds.GetDateTimeValue(variableName, i)));
     148      }
    142149      return run;
    143150    }
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r15159 r15161  
    181181    }
    182182
     183    public IEnumerable<string> DateTimeVariables {
     184      get { return variableValues.Where(p => p.Value is IList<DateTime>).Select(p => p.Key); }
     185    }
     186
    183187    public IEnumerable<double> GetDoubleValues(string variableName) {
    184188      return GetValues<double>(variableName);
     
    215219      return new ReadOnlyCollection<string>(values);
    216220    }
     221
     222    public DateTime GetDateTimeValue(string variableName, int row) {
     223      var values = GetValues<DateTime>(variableName);
     224      return values[row];
     225    }
     226    public IEnumerable<DateTime> GetDateTimeValues(string variableName, IEnumerable<int> rows) {
     227      return GetValues<DateTime>(variableName, rows);
     228    }
     229    public ReadOnlyCollection<DateTime> GetReadOnlyDateTimeValues(string variableName) {
     230      var values = GetValues<DateTime>(variableName);
     231      return new ReadOnlyCollection<DateTime>(values);
     232    }
     233
    217234
    218235    private IEnumerable<T> GetValues<T>(string variableName, IEnumerable<int> rows) {
  • stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataset.cs

    r15131 r15161  
    3131    IEnumerable<string> DoubleVariables { get; }
    3232    IEnumerable<string> StringVariables { get; }
     33    IEnumerable<string> DateTimeVariables { get; }
    3334
    3435    bool VariableHasType<T>(string variableName);
     
    4445    ReadOnlyCollection<string> GetReadOnlyStringValues(string VariableName);
    4546
     47    System.DateTime GetDateTimeValue(string variableName, int row);
    4648    IEnumerable<DateTime> GetDateTimeValues(string variableName);
     49    IEnumerable<DateTime> GetDateTimeValues(string variableName, IEnumerable<int> rows);
     50    ReadOnlyCollection<DateTime> GetReadOnlyDateTimeValues(string variableName);
    4751  }
    4852}
Note: See TracChangeset for help on using the changeset viewer.