Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15637 for trunk


Ignore:
Timestamp:
01/22/18 15:30:44 (7 years ago)
Author:
fholzing
Message:

#2871: Included the points from the review (added third sorting-possibility, renamed the existing ones, added default-behavior)

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.Designer.cs

    r15626 r15637  
    4444    /// </summary>
    4545    private void InitializeComponent() {
    46       this.variableImactsArrayView = new HeuristicLab.Data.Views.StringConvertibleArrayView();
    47       this.dataPartitionComboBox = new System.Windows.Forms.ComboBox();
    48       this.dataPartitionLabel = new System.Windows.Forms.Label();
    49       this.numericVarReplacementLabel = new System.Windows.Forms.Label();
    50       this.replacementComboBox = new System.Windows.Forms.ComboBox();
    51       this.factorVarReplacementLabel = new System.Windows.Forms.Label();
    52       this.factorVarReplComboBox = new System.Windows.Forms.ComboBox();
     46      this.ascendingCheckBox = new System.Windows.Forms.CheckBox();
    5347      this.sortByLabel = new System.Windows.Forms.Label();
    5448      this.sortByComboBox = new System.Windows.Forms.ComboBox();
    55       this.ascendingCheckBox = new System.Windows.Forms.CheckBox();
     49      this.factorVarReplComboBox = new System.Windows.Forms.ComboBox();
     50      this.factorVarReplacementLabel = new System.Windows.Forms.Label();
     51      this.replacementComboBox = new System.Windows.Forms.ComboBox();
     52      this.numericVarReplacementLabel = new System.Windows.Forms.Label();
     53      this.dataPartitionLabel = new System.Windows.Forms.Label();
     54      this.dataPartitionComboBox = new System.Windows.Forms.ComboBox();
     55      this.variableImactsArrayView = new HeuristicLab.Data.Views.StringConvertibleArrayView();
    5656      this.SuspendLayout();
    5757      //
    58       // variableImactsArrayView
    59       //
    60       this.variableImactsArrayView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    61             | System.Windows.Forms.AnchorStyles.Left)
    62             | System.Windows.Forms.AnchorStyles.Right)));
    63       this.variableImactsArrayView.Caption = "StringConvertibleArray View";
    64       this.variableImactsArrayView.Content = null;
    65       this.variableImactsArrayView.Location = new System.Drawing.Point(3, 84);
    66       this.variableImactsArrayView.Name = "variableImactsArrayView";
    67       this.variableImactsArrayView.ReadOnly = true;
    68       this.variableImactsArrayView.Size = new System.Drawing.Size(706, 278);
    69       this.variableImactsArrayView.TabIndex = 2;
    70       //
    71       // dataPartitionComboBox
    72       //
    73       this.dataPartitionComboBox.FormattingEnabled = true;
    74       this.dataPartitionComboBox.Items.AddRange(new object[] {
    75             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.Training,
    76             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.Test,
    77             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.All});
    78       this.dataPartitionComboBox.Location = new System.Drawing.Point(197, 3);
    79       this.dataPartitionComboBox.Name = "dataPartitionComboBox";
    80       this.dataPartitionComboBox.Size = new System.Drawing.Size(121, 21);
    81       this.dataPartitionComboBox.TabIndex = 1;
    82       this.dataPartitionComboBox.SelectedIndexChanged += new System.EventHandler(this.dataPartitionComboBox_SelectedIndexChanged);
    83       //
    84       // dataPartitionLabel
    85       //
    86       this.dataPartitionLabel.AutoSize = true;
    87       this.dataPartitionLabel.Location = new System.Drawing.Point(3, 6);
    88       this.dataPartitionLabel.Name = "dataPartitionLabel";
    89       this.dataPartitionLabel.Size = new System.Drawing.Size(73, 13);
    90       this.dataPartitionLabel.TabIndex = 0;
    91       this.dataPartitionLabel.Text = "Data partition:";
    92       //
    93       // numericVarReplacementLabel
    94       //
    95       this.numericVarReplacementLabel.AutoSize = true;
    96       this.numericVarReplacementLabel.Location = new System.Drawing.Point(3, 33);
    97       this.numericVarReplacementLabel.Name = "numericVarReplacementLabel";
    98       this.numericVarReplacementLabel.Size = new System.Drawing.Size(173, 13);
    99       this.numericVarReplacementLabel.TabIndex = 2;
    100       this.numericVarReplacementLabel.Text = "Replacement for numeric variables:";
     58      // ascendingCheckBox
     59      //
     60      this.ascendingCheckBox.AutoSize = true;
     61      this.ascendingCheckBox.Location = new System.Drawing.Point(534, 6);
     62      this.ascendingCheckBox.Name = "ascendingCheckBox";
     63      this.ascendingCheckBox.Size = new System.Drawing.Size(76, 17);
     64      this.ascendingCheckBox.TabIndex = 7;
     65      this.ascendingCheckBox.Text = "Ascending";
     66      this.ascendingCheckBox.UseVisualStyleBackColor = true;
     67      this.ascendingCheckBox.CheckedChanged += new System.EventHandler(this.ascendingCheckBox_CheckedChanged);
     68      //
     69      // sortByLabel
     70      //
     71      this.sortByLabel.AutoSize = true;
     72      this.sortByLabel.Location = new System.Drawing.Point(324, 6);
     73      this.sortByLabel.Name = "sortByLabel";
     74      this.sortByLabel.Size = new System.Drawing.Size(77, 13);
     75      this.sortByLabel.TabIndex = 4;
     76      this.sortByLabel.Text = "Sorting criteria:";
     77      //
     78      // sortByComboBox
     79      //
     80      this.sortByComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     81      this.sortByComboBox.FormattingEnabled = true;
     82      this.sortByComboBox.Items.AddRange(new object[] {
     83            "Impact Value",
     84            "Occurrence",
     85            "Variable Name"});
     86      this.sortByComboBox.Location = new System.Drawing.Point(407, 3);
     87      this.sortByComboBox.Name = "sortByComboBox";
     88      this.sortByComboBox.Size = new System.Drawing.Size(121, 21);
     89      this.sortByComboBox.TabIndex = 5;
     90      this.sortByComboBox.SelectedIndexChanged += new System.EventHandler(this.sortByComboBox_SelectedIndexChanged);
     91      //
     92      // factorVarReplComboBox
     93      //
     94      this.factorVarReplComboBox.FormattingEnabled = true;
     95      this.factorVarReplComboBox.Items.AddRange(new object[] {
     96            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Best,
     97            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Mode,
     98            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Shuffle});
     99      this.factorVarReplComboBox.Location = new System.Drawing.Point(197, 57);
     100      this.factorVarReplComboBox.Name = "factorVarReplComboBox";
     101      this.factorVarReplComboBox.Size = new System.Drawing.Size(121, 21);
     102      this.factorVarReplComboBox.TabIndex = 1;
     103      this.factorVarReplComboBox.SelectedIndexChanged += new System.EventHandler(this.replacementComboBox_SelectedIndexChanged);
     104      //
     105      // factorVarReplacementLabel
     106      //
     107      this.factorVarReplacementLabel.AutoSize = true;
     108      this.factorVarReplacementLabel.Location = new System.Drawing.Point(3, 60);
     109      this.factorVarReplacementLabel.Name = "factorVarReplacementLabel";
     110      this.factorVarReplacementLabel.Size = new System.Drawing.Size(188, 13);
     111      this.factorVarReplacementLabel.TabIndex = 0;
     112      this.factorVarReplacementLabel.Text = "Replacement for categorical variables:";
    101113      //
    102114      // replacementComboBox
     
    114126      this.replacementComboBox.SelectedIndexChanged += new System.EventHandler(this.replacementComboBox_SelectedIndexChanged);
    115127      //
    116       // factorVarReplacementLabel
    117       //
    118       this.factorVarReplacementLabel.AutoSize = true;
    119       this.factorVarReplacementLabel.Location = new System.Drawing.Point(3, 60);
    120       this.factorVarReplacementLabel.Name = "factorVarReplacementLabel";
    121       this.factorVarReplacementLabel.Size = new System.Drawing.Size(188, 13);
    122       this.factorVarReplacementLabel.TabIndex = 0;
    123       this.factorVarReplacementLabel.Text = "Replacement for categorical variables:";
    124       //
    125       // factorVarReplComboBox
    126       //
    127       this.factorVarReplComboBox.FormattingEnabled = true;
    128       this.factorVarReplComboBox.Items.AddRange(new object[] {
    129             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Best,
    130             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Mode,
    131             HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.FactorReplacementMethodEnum.Shuffle});
    132       this.factorVarReplComboBox.Location = new System.Drawing.Point(197, 57);
    133       this.factorVarReplComboBox.Name = "factorVarReplComboBox";
    134       this.factorVarReplComboBox.Size = new System.Drawing.Size(121, 21);
    135       this.factorVarReplComboBox.TabIndex = 1;
    136       this.factorVarReplComboBox.SelectedIndexChanged += new System.EventHandler(this.replacementComboBox_SelectedIndexChanged);
    137       //
    138       // sortByLabel
    139       //
    140       this.sortByLabel.AutoSize = true;
    141       this.sortByLabel.Location = new System.Drawing.Point(324, 6);
    142       this.sortByLabel.Name = "sortByLabel";
    143       this.sortByLabel.Size = new System.Drawing.Size(43, 13);
    144       this.sortByLabel.TabIndex = 4;
    145       this.sortByLabel.Text = "Sort by:";
    146       //
    147       // sortByComboBox
    148       //
    149       this.sortByComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    150       this.sortByComboBox.FormattingEnabled = true;
    151       this.sortByComboBox.Items.AddRange(new object[] {
    152             "Variable",
    153             "Impact"});
    154       this.sortByComboBox.Location = new System.Drawing.Point(373, 3);
    155       this.sortByComboBox.Name = "sortByComboBox";
    156       this.sortByComboBox.Size = new System.Drawing.Size(121, 21);
    157       this.sortByComboBox.TabIndex = 5;
    158       this.sortByComboBox.SelectedIndexChanged += new System.EventHandler(this.sortByComboBox_SelectedIndexChanged);
    159       this.sortByComboBox.SelectedIndex = 1;
    160       //
    161       // ascendingCheckBox
    162       //
    163       this.ascendingCheckBox.AutoSize = true;
    164       this.ascendingCheckBox.Location = new System.Drawing.Point(500, 6);
    165       this.ascendingCheckBox.Name = "ascendingCheckBox";
    166       this.ascendingCheckBox.Size = new System.Drawing.Size(76, 17);
    167       this.ascendingCheckBox.TabIndex = 7;
    168       this.ascendingCheckBox.Text = "Ascending";
    169       this.ascendingCheckBox.UseVisualStyleBackColor = true;
    170       this.ascendingCheckBox.CheckedChanged += new System.EventHandler(this.ascendingCheckBox_CheckedChanged);
     128      // numericVarReplacementLabel
     129      //
     130      this.numericVarReplacementLabel.AutoSize = true;
     131      this.numericVarReplacementLabel.Location = new System.Drawing.Point(3, 33);
     132      this.numericVarReplacementLabel.Name = "numericVarReplacementLabel";
     133      this.numericVarReplacementLabel.Size = new System.Drawing.Size(173, 13);
     134      this.numericVarReplacementLabel.TabIndex = 2;
     135      this.numericVarReplacementLabel.Text = "Replacement for numeric variables:";
     136      //
     137      // dataPartitionLabel
     138      //
     139      this.dataPartitionLabel.AutoSize = true;
     140      this.dataPartitionLabel.Location = new System.Drawing.Point(3, 6);
     141      this.dataPartitionLabel.Name = "dataPartitionLabel";
     142      this.dataPartitionLabel.Size = new System.Drawing.Size(73, 13);
     143      this.dataPartitionLabel.TabIndex = 0;
     144      this.dataPartitionLabel.Text = "Data partition:";
     145      //
     146      // dataPartitionComboBox
     147      //
     148      this.dataPartitionComboBox.FormattingEnabled = true;
     149      this.dataPartitionComboBox.Items.AddRange(new object[] {
     150            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.Training,
     151            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.Test,
     152            HeuristicLab.Problems.DataAnalysis.RegressionSolutionVariableImpactsCalculator.DataPartitionEnum.All});
     153      this.dataPartitionComboBox.Location = new System.Drawing.Point(197, 3);
     154      this.dataPartitionComboBox.Name = "dataPartitionComboBox";
     155      this.dataPartitionComboBox.Size = new System.Drawing.Size(121, 21);
     156      this.dataPartitionComboBox.TabIndex = 1;
     157      this.dataPartitionComboBox.SelectedIndexChanged += new System.EventHandler(this.dataPartitionComboBox_SelectedIndexChanged);
     158      //
     159      // variableImactsArrayView
     160      //
     161      this.variableImactsArrayView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     162            | System.Windows.Forms.AnchorStyles.Left)
     163            | System.Windows.Forms.AnchorStyles.Right)));
     164      this.variableImactsArrayView.Caption = "StringConvertibleArray View";
     165      this.variableImactsArrayView.Content = null;
     166      this.variableImactsArrayView.Location = new System.Drawing.Point(3, 84);
     167      this.variableImactsArrayView.Name = "variableImactsArrayView";
     168      this.variableImactsArrayView.ReadOnly = true;
     169      this.variableImactsArrayView.Size = new System.Drawing.Size(706, 278);
     170      this.variableImactsArrayView.TabIndex = 2;
    171171      //
    172172      // RegressionSolutionVariableImpactsView
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs

    r15626 r15637  
    2323using System.Linq;
    2424using System.Threading.Tasks;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Data;
    2627using HeuristicLab.MainForm;
     
    3233  public partial class RegressionSolutionVariableImpactsView : DataAnalysisSolutionEvaluationView {
    3334
    34     private const int ORDER_BY_VARIABLE = 0;
    35     private const int ORDER_BY_IMPACT = 1;
     35    private const int ORDER_BY_IMPACT = 0;
     36    private const int ORDER_BY_OCCURRENCE = 1;
     37    private const int ORDER_BY_NAME = 2;
    3638
    3739    private Dictionary<string, double> rawVariableImpacts = new Dictionary<string, double>();
     
    130132
    131133    private void sortByComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     134      //Update the default ordering (asc,desc), but remove the eventHandler beforehand (otherwise the data would be ordered twice)
     135      ascendingCheckBox.CheckedChanged -= ascendingCheckBox_CheckedChanged;
     136      switch (sortByComboBox.SelectedIndex) {
     137        case ORDER_BY_IMPACT: {
     138            ascendingCheckBox.Checked = false;
     139            break;
     140          }
     141        case ORDER_BY_OCCURRENCE: {
     142            ascendingCheckBox.Checked = true;
     143            break;
     144          }
     145        case ORDER_BY_NAME: {
     146            ascendingCheckBox.Checked = true;
     147            break;
     148          }
     149      }
     150      ascendingCheckBox.CheckedChanged += ascendingCheckBox_CheckedChanged;
     151
    132152      UpdateDataOrdering();
    133153    }
     
    152172
    153173        //Sort accordingly
    154         if (orderIdx == ORDER_BY_VARIABLE) {
    155           orderedEntries = ascending ? rawVariableImpacts : rawVariableImpacts.Reverse();
    156         } else if (orderIdx == ORDER_BY_IMPACT) {
    157           orderedEntries = ascending ? rawVariableImpacts.OrderBy(v => v.Value) : rawVariableImpacts.OrderByDescending(v => v.Value);
     174        switch (orderIdx) {
     175          case ORDER_BY_IMPACT: {
     176              orderedEntries = ascending ? rawVariableImpacts.OrderBy(v => v.Value) : rawVariableImpacts.OrderByDescending(v => v.Value);
     177              break;
     178            }
     179          case ORDER_BY_OCCURRENCE: {
     180              orderedEntries = ascending ? rawVariableImpacts : rawVariableImpacts.Reverse();
     181              break;
     182            }
     183          case ORDER_BY_NAME: {
     184              orderedEntries = ascending ? rawVariableImpacts.OrderBy(v => v.Key, new NaturalStringComparer()) : rawVariableImpacts.OrderByDescending(v => v.Key, new NaturalStringComparer());
     185              break;
     186            }
    158187        }
    159188
    160189        //Write the data back
    161         var impactArray = new DoubleArray(orderedEntries.Select(i => i.Value).ToArray());
    162         impactArray.ElementNames = orderedEntries.Select(i => i.Key);
     190        var impactArray = new DoubleArray(orderedEntries.Select(i => i.Value).ToArray()) {
     191          ElementNames = orderedEntries.Select(i => i.Key)
     192        };
    163193        variableImactsArrayView.Content = (DoubleArray)impactArray.AsReadOnly();
    164194      }
Note: See TracChangeset for help on using the changeset viewer.