Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/18/18 16:16:31 (6 years ago)
Author:
gkronber
Message:

#2915: merged changes in the trunk up to current HEAD (r15951:16232) into the branch

Location:
branches/2915-AbsoluteSymbol
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2915-AbsoluteSymbol

  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Views

  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs

    r15753 r16240  
    6060      InitializeComponent();
    6161
    62       //Little workaround. If you fill the ComboBox-Items in the other partial class, the UI-Designer will moan.
    6362      this.sortByComboBox.Items.AddRange(Enum.GetValues(typeof(SortingCriteria)).Cast<object>().ToArray());
    6463      this.sortByComboBox.SelectedItem = SortingCriteria.ImpactValue;
  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.Designer.cs

    r15752 r16240  
    1919 */
    2020#endregion
     21
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    8182      this.sortByComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    8283      this.sortByComboBox.FormattingEnabled = true;
     84      this.sortByComboBox.Items.AddRange(new object[] {
     85            HeuristicLab.Problems.DataAnalysis.Views.RegressionSolutionVariableImpactsView.SortingCriteria.ImpactValue,
     86            HeuristicLab.Problems.DataAnalysis.Views.RegressionSolutionVariableImpactsView.SortingCriteria.Occurrence,
     87            HeuristicLab.Problems.DataAnalysis.Views.RegressionSolutionVariableImpactsView.SortingCriteria.VariableName});
    8388      this.sortByComboBox.Location = new System.Drawing.Point(407, 3);
    8489      this.sortByComboBox.Name = "sortByComboBox";
     
    159164      // variableImactsArrayView
    160165      //
    161       this.variableImactsArrayView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    162             | System.Windows.Forms.AnchorStyles.Left) 
     166      this.variableImactsArrayView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     167            | System.Windows.Forms.AnchorStyles.Left)
    163168            | System.Windows.Forms.AnchorStyles.Right)));
    164169      this.variableImactsArrayView.Caption = "StringConvertibleArray View";
  • branches/2915-AbsoluteSymbol/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionVariableImpactsView.cs

    r15799 r16240  
    3939      VariableName
    4040    }
    41     private IProgress progress;
    42     private Dictionary<string, double> rawVariableImpacts = new Dictionary<string, double>();
     41    private List<Tuple<string, double>> rawVariableImpacts = new List<Tuple<string, double>>();
    4342
    4443    public new IRegressionSolution Content {
     
    5352      InitializeComponent();
    5453
    55       //Little workaround. If you fill the ComboBox-Items in the other partial class, the UI-Designer will moan.
    56       this.sortByComboBox.Items.AddRange(Enum.GetValues(typeof(SortingCriteria)).Cast<object>().ToArray());
    57       this.sortByComboBox.SelectedItem = SortingCriteria.ImpactValue;
    58 
    5954      //Set the default values
    6055      this.dataPartitionComboBox.SelectedIndex = 0;
    61       this.replacementComboBox.SelectedIndex = 0;
     56      this.replacementComboBox.SelectedIndex = 3;
    6257      this.factorVarReplComboBox.SelectedIndex = 0;
     58      this.sortByComboBox.SelectedItem = SortingCriteria.ImpactValue;
    6359    }
    6460
     
    9389
    9490    private void RegressionSolutionVariableImpactsView_VisibleChanged(object sender, EventArgs e) {
    95       if (!cancellationToken.IsCancellationRequested) {
    96         cancellationToken.Cancel();
    97       }
     91      cancellationToken.Cancel();
    9892    }
    9993
     
    110104      //Update the default ordering (asc,desc), but remove the eventHandler beforehand (otherwise the data would be ordered twice)
    111105      ascendingCheckBox.CheckedChanged -= ascendingCheckBox_CheckedChanged;
    112       switch ((SortingCriteria)sortByComboBox.SelectedItem) {
    113         case SortingCriteria.ImpactValue:
    114           ascendingCheckBox.Checked = false;
    115           break;
    116         case SortingCriteria.Occurrence:
    117           ascendingCheckBox.Checked = true;
    118           break;
    119         case SortingCriteria.VariableName:
    120           ascendingCheckBox.Checked = true;
    121           break;
    122         default:
    123           throw new NotImplementedException("Ordering for selected SortingCriteria not implemented");
    124       }
     106      ascendingCheckBox.Checked = (SortingCriteria)sortByComboBox.SelectedItem != SortingCriteria.ImpactValue;
    125107      ascendingCheckBox.CheckedChanged += ascendingCheckBox_CheckedChanged;
    126108
    127       UpdateDataOrdering();
     109      UpdateOrdering();
    128110    }
    129111
    130112    private void ascendingCheckBox_CheckedChanged(object sender, EventArgs e) {
    131       UpdateDataOrdering();
     113      UpdateOrdering();
    132114    }
    133115
    134116
    135117    private async void UpdateVariableImpact() {
     118      IProgress progress;
     119
    136120      //Check if the selection is valid
    137121      if (Content == null) { return; }
     
    163147        var problemData = Content.ProblemData;
    164148        var inputvariables = new HashSet<string>(problemData.AllowedInputVariables.Union(Content.Model.VariablesUsedForPrediction));
    165         var originalVariableOrdering = problemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).Where(problemData.Dataset.VariableHasType<double>).ToList();
     149        var originalVariableOrdering = problemData.Dataset.VariableNames
     150          .Where(v => inputvariables.Contains(v))
     151          .Where(v => problemData.Dataset.VariableHasType<double>(v) || problemData.Dataset.VariableHasType<string>(v))
     152          .ToList();
    166153
    167154        rawVariableImpacts.Clear();
    168         originalVariableOrdering.ForEach(v => rawVariableImpacts.Add(v, impacts.First(vv => vv.Item1 == v).Item2));
    169         UpdateDataOrdering();
     155        originalVariableOrdering.ForEach(v => rawVariableImpacts.Add(new Tuple<string, double>(v, impacts.First(vv => vv.Item1 == v).Item2)));
     156        UpdateOrdering();
    170157      } finally {
    171158        ((MainForm.WindowsForms.MainForm)MainFormManager.MainForm).RemoveOperationProgressFromView(this);
     
    177164    /// The default is "Descending" by "VariableImpact" (as in previous versions)
    178165    /// </summary>
    179     private void UpdateDataOrdering() {
     166    private void UpdateOrdering() {
    180167      //Check if valid sortingCriteria is selected and data exists
    181168      if (sortByComboBox.SelectedIndex == -1) { return; }
     
    186173      bool ascending = ascendingCheckBox.Checked;
    187174
    188       IEnumerable<KeyValuePair<string, double>> orderedEntries = null;
     175      IEnumerable<Tuple<string, double>> orderedEntries = null;
    189176
    190177      //Sort accordingly
    191178      switch (selectedItem) {
    192179        case SortingCriteria.ImpactValue:
    193           orderedEntries = rawVariableImpacts.OrderBy(v => v.Value);
     180          orderedEntries = rawVariableImpacts.OrderBy(v => v.Item2);
    194181          break;
    195182        case SortingCriteria.Occurrence:
     
    197184          break;
    198185        case SortingCriteria.VariableName:
    199           orderedEntries = rawVariableImpacts.OrderBy(v => v.Key, new NaturalStringComparer());
     186          orderedEntries = rawVariableImpacts.OrderBy(v => v.Item1, new NaturalStringComparer());
    200187          break;
    201188        default:
     
    206193
    207194      //Write the data back
    208       var impactArray = new DoubleArray(orderedEntries.Select(i => i.Value).ToArray()) {
    209         ElementNames = orderedEntries.Select(i => i.Key)
     195      var impactArray = new DoubleArray(orderedEntries.Select(i => i.Item2).ToArray()) {
     196        ElementNames = orderedEntries.Select(i => i.Item1)
    210197      };
    211198
Note: See TracChangeset for help on using the changeset viewer.