Changeset 16445


Ignore:
Timestamp:
12/21/18 15:37:44 (2 months ago)
Author:
pfleck
Message:

#2972 Implemented 1st version (UI is subject to change)

Location:
branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs

    r15845 r16445  
    167167      // add an event such that whenever a value is changed in the shared dataset,
    168168      // this change is reflected in the internal dataset (where the value becomes a whole column)
    169       if (this.sharedFixedVariables != null)
     169      if (this.sharedFixedVariables != null) {
    170170        this.sharedFixedVariables.ItemChanged -= sharedFixedVariables_ItemChanged;
     171        this.sharedFixedVariables.Reset -= sharedFixedVariables_Reset;
     172      }
     173
    171174      this.sharedFixedVariables = sharedFixedVariables;
    172175      this.sharedFixedVariables.ItemChanged += sharedFixedVariables_ItemChanged;
     176      this.sharedFixedVariables.Reset += sharedFixedVariables_Reset;
    173177
    174178      RecalculateInternalDataset();
     
    218222        if (updateOnFinish)
    219223          Update();
    220       }
    221       catch (OperationCanceledException) { }
    222       catch (AggregateException ae) {
     224      } catch (OperationCanceledException) { } catch (AggregateException ae) {
    223225        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
    224226          throw;
     
    495497    }
    496498
     499    private void sharedFixedVariables_Reset(object sender, EventArgs e) {
     500      var newValue = sharedFixedVariables.GetStringValue(FreeVariable, 0);
     501      UpdateSelectedValue(newValue);
     502
     503      int idx = variableValues.IndexOf(newValue);
     504      UpdateAllSeriesStyles(idx);
     505    }
     506
    497507    private async void chart_DragDrop(object sender, DragEventArgs e) {
    498508      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs

    r15845 r16445  
    245245      // add an event such that whenever a value is changed in the shared dataset,
    246246      // this change is reflected in the internal dataset (where the value becomes a whole column)
    247       if (this.sharedFixedVariables != null)
     247      if (this.sharedFixedVariables != null) {
    248248        this.sharedFixedVariables.ItemChanged -= sharedFixedVariables_ItemChanged;
     249        this.sharedFixedVariables.Reset -= sharedFixedVariables_Reset;
     250      }
     251
    249252      this.sharedFixedVariables = sharedFixedVariables;
    250253      this.sharedFixedVariables.ItemChanged += sharedFixedVariables_ItemChanged;
     254      this.sharedFixedVariables.Reset += sharedFixedVariables_Reset;
    251255
    252256      RecalculateTrainingLimits(initializeAxisRanges);
     
    314318        if (updateOnFinish)
    315319          Update();
    316       }
    317       catch (OperationCanceledException) { }
    318       catch (AggregateException ae) {
     320      } catch (OperationCanceledException) { } catch (AggregateException ae) {
    319321        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
    320322          throw;
     
    625627
    626628      var variableName = variables[columnIndex];
    627       if (variableName == FreeVariable) return;
     629      if (variableName == FreeVariable) {
     630        return;
     631      }
    628632      if (internalDataset.VariableHasType<double>(variableName)) {
    629633        var v = sharedFixedVariables.GetDoubleValue(variableName, rowIndex);
     
    640644    }
    641645
     646    private void sharedFixedVariables_Reset(object sender, EventArgs e) {
     647      var newValue = sharedFixedVariables.GetDoubleValue(FreeVariable, 0);
     648      VerticalLineAnnotation.X = newValue;
     649      UpdateCursor();  // triggers update of InternalDataset
     650    }
     651
    642652    private void chart_AnnotationPositionChanging(object sender, AnnotationPositionChangingEventArgs e) {
    643653      var step = (trainingMax - trainingMin) / drawingSteps;
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IPartialDependencePlot.cs

    r15583 r16445  
    2525  public interface IPartialDependencePlot {
    2626    Task RecalculateAsync(bool updateOnFinish, bool resetYAxis);
    27     double YMin { get;  }
     27    double YMin { get; }
    2828    double YMax { get; }
    2929    double? FixedYAxisMin { get; set; }
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs

    r14852 r16445  
    3131      this.automaticYAxisCheckBox = new System.Windows.Forms.CheckBox();
    3232      this.densityGroupBox = new System.Windows.Forms.GroupBox();
     33      this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    3334      this.columnsLabel = new System.Windows.Forms.Label();
    3435      this.densityComboBox = new System.Windows.Forms.ComboBox();
     
    3637      this.configSplitContainer = new System.Windows.Forms.SplitContainer();
    3738      this.variableGroupBox = new System.Windows.Forms.GroupBox();
     39      this.rowSelectGroupBox = new System.Windows.Forms.GroupBox();
     40      this.comboBox1 = new System.Windows.Forms.ComboBox();
     41      this.label2 = new System.Windows.Forms.Label();
     42      this.rowNrNumericUpDown = new System.Windows.Forms.NumericUpDown();
    3843      this.scrollPanel = new System.Windows.Forms.Panel();
    3944      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    40       this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    4145      this.yAxisConfigGroupBox.SuspendLayout();
    4246      this.densityGroupBox.SuspendLayout();
     47      ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();
    4348      ((System.ComponentModel.ISupportInitialize)(this.configSplitContainer)).BeginInit();
    4449      this.configSplitContainer.Panel1.SuspendLayout();
     
    4651      this.configSplitContainer.SuspendLayout();
    4752      this.variableGroupBox.SuspendLayout();
     53      this.rowSelectGroupBox.SuspendLayout();
     54      ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).BeginInit();
    4855      this.scrollPanel.SuspendLayout();
    4956      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    50       ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();
    5157      this.SuspendLayout();
    5258      //
     
    5763      this.variableListView.Location = new System.Drawing.Point(3, 16);
    5864      this.variableListView.Name = "variableListView";
    59       this.variableListView.Size = new System.Drawing.Size(163, 478);
     65      this.variableListView.Size = new System.Drawing.Size(163, 404);
    6066      this.variableListView.TabIndex = 0;
    6167      this.variableListView.UseCompatibleStateImageBehavior = false;
     
    126132      this.densityGroupBox.TabStop = false;
    127133      this.densityGroupBox.Text = "Settings";
    128       //
    129       // columnsLabel
    130       //
    131       this.columnsLabel.AutoSize = true;
    132       this.columnsLabel.Location = new System.Drawing.Point(7, 49);
    133       this.columnsLabel.Name = "columnsLabel";
    134       this.columnsLabel.Size = new System.Drawing.Size(50, 13);
    135       this.columnsLabel.TabIndex = 0;
    136       this.columnsLabel.Text = "Columns:";
    137       //
    138       // densityComboBox
    139       //
    140       this.densityComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    141             | System.Windows.Forms.AnchorStyles.Right)));
    142       this.densityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    143       this.densityComboBox.FormattingEnabled = true;
    144       this.densityComboBox.Items.AddRange(new object[] {
    145             "None",
    146             "Training",
    147             "Test",
    148             "All"});
    149       this.densityComboBox.Location = new System.Drawing.Point(66, 19);
    150       this.densityComboBox.Name = "densityComboBox";
    151       this.densityComboBox.Size = new System.Drawing.Size(94, 21);
    152       this.densityComboBox.TabIndex = 0;
    153       this.densityComboBox.SelectedIndexChanged += new System.EventHandler(this.densityComboBox_SelectedIndexChanged);
    154       //
    155       // label1
    156       //
    157       this.label1.AutoSize = true;
    158       this.label1.Location = new System.Drawing.Point(7, 22);
    159       this.label1.Name = "label1";
    160       this.label1.Size = new System.Drawing.Size(45, 13);
    161       this.label1.TabIndex = 0;
    162       this.label1.Text = "Density:";
    163       //
    164       // configSplitContainer
    165       //
    166       this.configSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    167       this.configSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
    168       this.configSplitContainer.Location = new System.Drawing.Point(0, 0);
    169       this.configSplitContainer.Name = "configSplitContainer";
    170       //
    171       // configSplitContainer.Panel1
    172       //
    173       this.configSplitContainer.Panel1.Controls.Add(this.variableGroupBox);
    174       this.configSplitContainer.Panel1.Controls.Add(this.densityGroupBox);
    175       this.configSplitContainer.Panel1.Controls.Add(this.yAxisConfigGroupBox);
    176       //
    177       // configSplitContainer.Panel2
    178       //
    179       this.configSplitContainer.Panel2.Controls.Add(this.scrollPanel);
    180       this.configSplitContainer.Size = new System.Drawing.Size(715, 648);
    181       this.configSplitContainer.SplitterDistance = 169;
    182       this.configSplitContainer.TabIndex = 0;
    183       this.configSplitContainer.TabStop = false;
    184       //
    185       // variableGroupBox
    186       //
    187       this.variableGroupBox.Controls.Add(this.variableListView);
    188       this.variableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    189       this.variableGroupBox.Location = new System.Drawing.Point(0, 151);
    190       this.variableGroupBox.Name = "variableGroupBox";
    191       this.variableGroupBox.Size = new System.Drawing.Size(169, 497);
    192       this.variableGroupBox.TabIndex = 1;
    193       this.variableGroupBox.TabStop = false;
    194       this.variableGroupBox.Text = "Variables";
    195       //
    196       // scrollPanel
    197       //
    198       this.scrollPanel.Controls.Add(this.partialDependencePlotTableLayout);
    199       this.scrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
    200       this.scrollPanel.Location = new System.Drawing.Point(0, 0);
    201       this.scrollPanel.Name = "scrollPanel";
    202       this.scrollPanel.Size = new System.Drawing.Size(542, 648);
    203       this.scrollPanel.TabIndex = 0;
    204       //
    205       // errorProvider
    206       //
    207       this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
    208       this.errorProvider.ContainerControl = this;
    209134      //
    210135      // columnsNumericUpDown
     
    228153      this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged);
    229154      //
     155      // columnsLabel
     156      //
     157      this.columnsLabel.AutoSize = true;
     158      this.columnsLabel.Location = new System.Drawing.Point(7, 49);
     159      this.columnsLabel.Name = "columnsLabel";
     160      this.columnsLabel.Size = new System.Drawing.Size(50, 13);
     161      this.columnsLabel.TabIndex = 0;
     162      this.columnsLabel.Text = "Columns:";
     163      //
     164      // densityComboBox
     165      //
     166      this.densityComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     167            | System.Windows.Forms.AnchorStyles.Right)));
     168      this.densityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     169      this.densityComboBox.FormattingEnabled = true;
     170      this.densityComboBox.Items.AddRange(new object[] {
     171            "None",
     172            "Training",
     173            "Test",
     174            "All"});
     175      this.densityComboBox.Location = new System.Drawing.Point(66, 19);
     176      this.densityComboBox.Name = "densityComboBox";
     177      this.densityComboBox.Size = new System.Drawing.Size(94, 21);
     178      this.densityComboBox.TabIndex = 0;
     179      this.densityComboBox.SelectedIndexChanged += new System.EventHandler(this.densityComboBox_SelectedIndexChanged);
     180      //
     181      // label1
     182      //
     183      this.label1.AutoSize = true;
     184      this.label1.Location = new System.Drawing.Point(7, 22);
     185      this.label1.Name = "label1";
     186      this.label1.Size = new System.Drawing.Size(45, 13);
     187      this.label1.TabIndex = 0;
     188      this.label1.Text = "Density:";
     189      //
     190      // configSplitContainer
     191      //
     192      this.configSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     193      this.configSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
     194      this.configSplitContainer.Location = new System.Drawing.Point(0, 0);
     195      this.configSplitContainer.Name = "configSplitContainer";
     196      //
     197      // configSplitContainer.Panel1
     198      //
     199      this.configSplitContainer.Panel1.Controls.Add(this.variableGroupBox);
     200      this.configSplitContainer.Panel1.Controls.Add(this.rowSelectGroupBox);
     201      this.configSplitContainer.Panel1.Controls.Add(this.densityGroupBox);
     202      this.configSplitContainer.Panel1.Controls.Add(this.yAxisConfigGroupBox);
     203      //
     204      // configSplitContainer.Panel2
     205      //
     206      this.configSplitContainer.Panel2.Controls.Add(this.scrollPanel);
     207      this.configSplitContainer.Size = new System.Drawing.Size(715, 648);
     208      this.configSplitContainer.SplitterDistance = 169;
     209      this.configSplitContainer.TabIndex = 0;
     210      this.configSplitContainer.TabStop = false;
     211      //
     212      // variableGroupBox
     213      //
     214      this.variableGroupBox.Controls.Add(this.variableListView);
     215      this.variableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
     216      this.variableGroupBox.Location = new System.Drawing.Point(0, 151);
     217      this.variableGroupBox.Name = "variableGroupBox";
     218      this.variableGroupBox.Size = new System.Drawing.Size(169, 423);
     219      this.variableGroupBox.TabIndex = 1;
     220      this.variableGroupBox.TabStop = false;
     221      this.variableGroupBox.Text = "Variables";
     222      //
     223      // rowSelectGroupBox
     224      //
     225      this.rowSelectGroupBox.Controls.Add(this.comboBox1);
     226      this.rowSelectGroupBox.Controls.Add(this.label2);
     227      this.rowSelectGroupBox.Controls.Add(this.rowNrNumericUpDown);
     228      this.rowSelectGroupBox.Dock = System.Windows.Forms.DockStyle.Bottom;
     229      this.rowSelectGroupBox.Location = new System.Drawing.Point(0, 574);
     230      this.rowSelectGroupBox.Name = "rowSelectGroupBox";
     231      this.rowSelectGroupBox.Size = new System.Drawing.Size(169, 74);
     232      this.rowSelectGroupBox.TabIndex = 1;
     233      this.rowSelectGroupBox.TabStop = false;
     234      this.rowSelectGroupBox.Text = "Set Fixed Variable Values";
     235      //
     236      // comboBox1
     237      //
     238      this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     239      this.comboBox1.FormattingEnabled = true;
     240      this.comboBox1.Items.AddRange(new object[] {
     241            "Mean",
     242            "Median",
     243            "Most Common"});
     244      this.comboBox1.Location = new System.Drawing.Point(10, 45);
     245      this.comboBox1.Name = "comboBox1";
     246      this.comboBox1.Size = new System.Drawing.Size(150, 21);
     247      this.comboBox1.TabIndex = 3;
     248      //
     249      // label2
     250      //
     251      this.label2.AutoSize = true;
     252      this.label2.Location = new System.Drawing.Point(7, 21);
     253      this.label2.Name = "label2";
     254      this.label2.Size = new System.Drawing.Size(46, 13);
     255      this.label2.TabIndex = 2;
     256      this.label2.Text = "Row Nr.";
     257      //
     258      // rowNrNumericUpDown
     259      //
     260      this.rowNrNumericUpDown.Location = new System.Drawing.Point(66, 19);
     261      this.rowNrNumericUpDown.Name = "rowNrNumericUpDown";
     262      this.rowNrNumericUpDown.Size = new System.Drawing.Size(94, 20);
     263      this.rowNrNumericUpDown.TabIndex = 1;
     264      this.rowNrNumericUpDown.ValueChanged += new System.EventHandler(this.rowNrNumericUpDown_ValueChanged);
     265      //
     266      // scrollPanel
     267      //
     268      this.scrollPanel.Controls.Add(this.partialDependencePlotTableLayout);
     269      this.scrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     270      this.scrollPanel.Location = new System.Drawing.Point(0, 0);
     271      this.scrollPanel.Name = "scrollPanel";
     272      this.scrollPanel.Size = new System.Drawing.Size(542, 648);
     273      this.scrollPanel.TabIndex = 0;
     274      //
     275      // errorProvider
     276      //
     277      this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     278      this.errorProvider.ContainerControl = this;
     279      //
    230280      // RegressionSolutionPartialDependencePlotView
    231281      //
     
    239289      this.densityGroupBox.ResumeLayout(false);
    240290      this.densityGroupBox.PerformLayout();
     291      ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();
    241292      this.configSplitContainer.Panel1.ResumeLayout(false);
    242293      this.configSplitContainer.Panel2.ResumeLayout(false);
     
    244295      this.configSplitContainer.ResumeLayout(false);
    245296      this.variableGroupBox.ResumeLayout(false);
     297      this.rowSelectGroupBox.ResumeLayout(false);
     298      this.rowSelectGroupBox.PerformLayout();
     299      ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).EndInit();
    246300      this.scrollPanel.ResumeLayout(false);
    247301      this.scrollPanel.PerformLayout();
    248302      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    249       ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();
    250303      this.ResumeLayout(false);
    251304
     
    268321    private System.Windows.Forms.Label label1;
    269322    private System.Windows.Forms.NumericUpDown columnsNumericUpDown;
     323    private System.Windows.Forms.GroupBox rowSelectGroupBox;
     324    private System.Windows.Forms.ComboBox comboBox1;
     325    private System.Windows.Forms.Label label2;
     326    private System.Windows.Forms.NumericUpDown rowNrNumericUpDown;
    270327  }
    271328}
  • branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r15583 r16445  
    231231      sharedFixedVariables.ItemChanged += SharedFixedVariables_ItemChanged;
    232232
     233      rowNrNumericUpDown.Maximum = Content.ProblemData.Dataset.Rows - 1;
     234
    233235      RecalculateAndRelayoutCharts();
    234236    }
     
    564566      }
    565567    }
     568
     569    private void rowNrNumericUpDown_ValueChanged(object sender, EventArgs e) {
     570      int rowNumber = (int)rowNrNumericUpDown.Value;
     571      var dataset = Content.ProblemData.Dataset;
     572
     573      object[] newRow = sharedFixedVariables.VariableNames
     574        .Select<string, object>(variableName => {
     575          if (dataset.DoubleVariables.Contains(variableName)) {
     576            return dataset.GetDoubleValue(variableName, rowNumber);
     577          } else if (dataset.StringVariables.Contains(variableName)) {
     578            return dataset.GetStringValue(variableName, rowNumber);
     579          } else {
     580            throw new NotSupportedException("Only double and string(factor) columns are currently supported.");
     581          }
     582        }).ToArray();
     583
     584      sharedFixedVariables.ReplaceRow(0, newRow);
     585    }
    566586  }
    567587}
Note: See TracChangeset for help on using the changeset viewer.