Free cookie consent management tool by TermsFeed Policy Generator

Changeset 16519


Ignore:
Timestamp:
01/08/19 15:29:57 (6 years ago)
Author:
pfleck
Message:

#2972 merged to trunk

Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/HeuristicLab.Algorithms.DataAnalysis

  • trunk/HeuristicLab.Algorithms.DataAnalysis.Views

  • trunk/HeuristicLab.Algorithms.DataAnalysis/3.4

  • trunk/HeuristicLab.Clients.Hive.Administrator

  • trunk/HeuristicLab.Clients.Hive.JobManager

  • trunk/HeuristicLab.DataPreprocessing.Views

  • trunk/HeuristicLab.Optimization.Views

  • trunk/HeuristicLab.Optimizer

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4

  • trunk/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • trunk/HeuristicLab.Problems.DataAnalysis.Views

  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs

    r15845 r16519  
    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) {
     225      } catch (AggregateException ae) {
    223226        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
    224227          throw;
     
    495498    }
    496499
     500    private void sharedFixedVariables_Reset(object sender, EventArgs e) {
     501      var newValue = sharedFixedVariables.GetStringValue(FreeVariable, 0);
     502      UpdateSelectedValue(newValue);
     503
     504      int idx = variableValues.IndexOf(newValue);
     505      UpdateAllSeriesStyles(idx);
     506    }
     507
    497508    private async void chart_DragDrop(object sender, DragEventArgs e) {
    498509      var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs

    r15845 r16519  
    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) {
     321      } catch (AggregateException ae) {
    319322        if (!ae.InnerExceptions.Any(e => e is OperationCanceledException))
    320323          throw;
     
    626629      var variableName = variables[columnIndex];
    627630      if (variableName == FreeVariable) 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;
     
    658668    private void UpdateCursor() {
    659669      var x = VerticalLineAnnotation.X;
    660       sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
     670
     671      if (!sharedFixedVariables.GetDoubleValue(FreeVariable, 0).IsAlmost(x))
     672        sharedFixedVariables.SetVariableValue(x, FreeVariable, 0);
    661673
    662674      if (ShowCursor) {
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IPartialDependencePlot.cs

    r15583 r16519  
    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; }
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs

    r14852 r16519  
    2525    private void InitializeComponent() {
    2626      this.components = new System.ComponentModel.Container();
     27      this.variableValuesModeComboBox = new System.Windows.Forms.ComboBox();
     28      this.configSplitContainer = new System.Windows.Forms.SplitContainer();
     29      this.variableGroupBox = new System.Windows.Forms.GroupBox();
    2730      this.variableListView = new System.Windows.Forms.ListView();
    28       this.partialDependencePlotTableLayout = new System.Windows.Forms.TableLayoutPanel();
     31      this.rowSelectGroupBox = new System.Windows.Forms.GroupBox();
     32      this.rowLabel = new System.Windows.Forms.Label();
     33      this.rowNrNumericUpDown = new System.Windows.Forms.NumericUpDown();
     34      this.densityGroupBox = new System.Windows.Forms.GroupBox();
     35      this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown();
     36      this.columnsLabel = new System.Windows.Forms.Label();
     37      this.densityComboBox = new System.Windows.Forms.ComboBox();
     38      this.densityLabel = new System.Windows.Forms.Label();
    2939      this.yAxisConfigGroupBox = new System.Windows.Forms.GroupBox();
    3040      this.limitView = new HeuristicLab.Problems.DataAnalysis.Views.DoubleLimitView();
    3141      this.automaticYAxisCheckBox = new System.Windows.Forms.CheckBox();
    32       this.densityGroupBox = new System.Windows.Forms.GroupBox();
    33       this.columnsLabel = new System.Windows.Forms.Label();
    34       this.densityComboBox = new System.Windows.Forms.ComboBox();
    35       this.label1 = new System.Windows.Forms.Label();
    36       this.configSplitContainer = new System.Windows.Forms.SplitContainer();
    37       this.variableGroupBox = new System.Windows.Forms.GroupBox();
    3842      this.scrollPanel = new System.Windows.Forms.Panel();
     43      this.partialDependencePlotTableLayout = new System.Windows.Forms.TableLayoutPanel();
    3944      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    40       this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown();
    41       this.yAxisConfigGroupBox.SuspendLayout();
    42       this.densityGroupBox.SuspendLayout();
     45      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    4346      ((System.ComponentModel.ISupportInitialize)(this.configSplitContainer)).BeginInit();
    4447      this.configSplitContainer.Panel1.SuspendLayout();
     
    4649      this.configSplitContainer.SuspendLayout();
    4750      this.variableGroupBox.SuspendLayout();
     51      this.rowSelectGroupBox.SuspendLayout();
     52      ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).BeginInit();
     53      this.densityGroupBox.SuspendLayout();
     54      ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();
     55      this.yAxisConfigGroupBox.SuspendLayout();
    4856      this.scrollPanel.SuspendLayout();
    4957      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    50       ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();
    5158      this.SuspendLayout();
     59      //
     60      // variableValuesModeComboBox
     61      //
     62      this.variableValuesModeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     63      this.variableValuesModeComboBox.Items.AddRange(new object[] {
     64            "Row",
     65            "Mean",
     66            "Median",
     67            "Most Common"});
     68      this.variableValuesModeComboBox.Location = new System.Drawing.Point(10, 19);
     69      this.variableValuesModeComboBox.Name = "variableValuesModeComboBox";
     70      this.variableValuesModeComboBox.Size = new System.Drawing.Size(150, 21);
     71      this.variableValuesModeComboBox.TabIndex = 3;
     72      this.variableValuesModeComboBox.SelectedValueChanged += new System.EventHandler(this.variableValuesComboBox_SelectedValueChanged);
     73      this.variableValuesModeComboBox.MouseLeave += new System.EventHandler(this.variableValuesModeComboBox_MouseLeave);
     74      this.variableValuesModeComboBox.MouseHover += new System.EventHandler(this.variableValuesModeComboBox_MouseHover);
     75      //
     76      // configSplitContainer
     77      //
     78      this.configSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
     79      this.configSplitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
     80      this.configSplitContainer.Location = new System.Drawing.Point(0, 0);
     81      this.configSplitContainer.Name = "configSplitContainer";
     82      //
     83      // configSplitContainer.Panel1
     84      //
     85      this.configSplitContainer.Panel1.Controls.Add(this.variableGroupBox);
     86      this.configSplitContainer.Panel1.Controls.Add(this.rowSelectGroupBox);
     87      this.configSplitContainer.Panel1.Controls.Add(this.densityGroupBox);
     88      this.configSplitContainer.Panel1.Controls.Add(this.yAxisConfigGroupBox);
     89      //
     90      // configSplitContainer.Panel2
     91      //
     92      this.configSplitContainer.Panel2.Controls.Add(this.scrollPanel);
     93      this.configSplitContainer.Size = new System.Drawing.Size(715, 648);
     94      this.configSplitContainer.SplitterDistance = 169;
     95      this.configSplitContainer.TabIndex = 0;
     96      this.configSplitContainer.TabStop = false;
     97      //
     98      // variableGroupBox
     99      //
     100      this.variableGroupBox.Controls.Add(this.variableListView);
     101      this.variableGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
     102      this.variableGroupBox.Location = new System.Drawing.Point(0, 225);
     103      this.variableGroupBox.Name = "variableGroupBox";
     104      this.variableGroupBox.Size = new System.Drawing.Size(169, 423);
     105      this.variableGroupBox.TabIndex = 1;
     106      this.variableGroupBox.TabStop = false;
     107      this.variableGroupBox.Text = "Variables";
    52108      //
    53109      // variableListView
     
    57113      this.variableListView.Location = new System.Drawing.Point(3, 16);
    58114      this.variableListView.Name = "variableListView";
    59       this.variableListView.Size = new System.Drawing.Size(163, 478);
     115      this.variableListView.Size = new System.Drawing.Size(163, 404);
    60116      this.variableListView.TabIndex = 0;
    61117      this.variableListView.UseCompatibleStateImageBehavior = false;
     
    63119      this.variableListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.variableListView_ItemChecked);
    64120      //
    65       // partialDependencePlotTableLayout
    66       //
    67       this.partialDependencePlotTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    68             | System.Windows.Forms.AnchorStyles.Right)));
    69       this.partialDependencePlotTableLayout.AutoSize = true;
    70       this.partialDependencePlotTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
    71       this.partialDependencePlotTableLayout.ColumnCount = 1;
    72       this.partialDependencePlotTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
    73       this.partialDependencePlotTableLayout.Location = new System.Drawing.Point(0, 0);
    74       this.partialDependencePlotTableLayout.Name = "partialDependencePlotTableLayout";
    75       this.partialDependencePlotTableLayout.RowCount = 1;
    76       this.partialDependencePlotTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
    77       this.partialDependencePlotTableLayout.Size = new System.Drawing.Size(542, 0);
    78       this.partialDependencePlotTableLayout.TabIndex = 2;
    79       //
    80       // yAxisConfigGroupBox
    81       //
    82       this.yAxisConfigGroupBox.Controls.Add(this.limitView);
    83       this.yAxisConfigGroupBox.Controls.Add(this.automaticYAxisCheckBox);
    84       this.yAxisConfigGroupBox.Dock = System.Windows.Forms.DockStyle.Top;
    85       this.yAxisConfigGroupBox.Location = new System.Drawing.Point(0, 0);
    86       this.yAxisConfigGroupBox.Name = "yAxisConfigGroupBox";
    87       this.yAxisConfigGroupBox.Size = new System.Drawing.Size(169, 77);
    88       this.yAxisConfigGroupBox.TabIndex = 2;
    89       this.yAxisConfigGroupBox.TabStop = false;
    90       this.yAxisConfigGroupBox.Text = "Y-Axis";
    91       //
    92       // limitView
    93       //
    94       this.limitView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    95             | System.Windows.Forms.AnchorStyles.Right)));
    96       this.limitView.Caption = "DoubleLimit View";
    97       this.limitView.Content = null;
    98       this.limitView.Location = new System.Drawing.Point(6, 20);
    99       this.limitView.Name = "limitView";
    100       this.limitView.ReadOnly = false;
    101       this.limitView.Size = new System.Drawing.Size(157, 47);
    102       this.limitView.TabIndex = 1;
    103       //
    104       // automaticYAxisCheckBox
    105       //
    106       this.automaticYAxisCheckBox.AutoSize = true;
    107       this.automaticYAxisCheckBox.Location = new System.Drawing.Point(49, -1);
    108       this.automaticYAxisCheckBox.Name = "automaticYAxisCheckBox";
    109       this.automaticYAxisCheckBox.Size = new System.Drawing.Size(73, 17);
    110       this.automaticYAxisCheckBox.TabIndex = 0;
    111       this.automaticYAxisCheckBox.Text = "Automatic";
    112       this.automaticYAxisCheckBox.UseVisualStyleBackColor = true;
    113       this.automaticYAxisCheckBox.CheckedChanged += new System.EventHandler(this.automaticYAxisCheckBox_CheckedChanged);
     121      // rowSelectGroupBox
     122      //
     123      this.rowSelectGroupBox.Controls.Add(this.variableValuesModeComboBox);
     124      this.rowSelectGroupBox.Controls.Add(this.rowLabel);
     125      this.rowSelectGroupBox.Controls.Add(this.rowNrNumericUpDown);
     126      this.rowSelectGroupBox.Dock = System.Windows.Forms.DockStyle.Top;
     127      this.rowSelectGroupBox.Location = new System.Drawing.Point(0, 151);
     128      this.rowSelectGroupBox.Name = "rowSelectGroupBox";
     129      this.rowSelectGroupBox.Size = new System.Drawing.Size(169, 74);
     130      this.rowSelectGroupBox.TabIndex = 1;
     131      this.rowSelectGroupBox.TabStop = false;
     132      this.rowSelectGroupBox.Text = "Variable Values";
     133      //
     134      // rowLabel
     135      //
     136      this.rowLabel.AutoSize = true;
     137      this.rowLabel.Location = new System.Drawing.Point(7, 48);
     138      this.rowLabel.Name = "rowLabel";
     139      this.rowLabel.Size = new System.Drawing.Size(46, 13);
     140      this.rowLabel.TabIndex = 2;
     141      this.rowLabel.Text = "Row Nr.";
     142      //
     143      // rowNrNumericUpDown
     144      //
     145      this.rowNrNumericUpDown.Location = new System.Drawing.Point(66, 46);
     146      this.rowNrNumericUpDown.Name = "rowNrNumericUpDown";
     147      this.rowNrNumericUpDown.Size = new System.Drawing.Size(94, 20);
     148      this.rowNrNumericUpDown.TabIndex = 1;
     149      this.rowNrNumericUpDown.ValueChanged += new System.EventHandler(this.rowNrNumericUpDown_ValueChanged);
    114150      //
    115151      // densityGroupBox
     
    118154      this.densityGroupBox.Controls.Add(this.columnsLabel);
    119155      this.densityGroupBox.Controls.Add(this.densityComboBox);
    120       this.densityGroupBox.Controls.Add(this.label1);
     156      this.densityGroupBox.Controls.Add(this.densityLabel);
    121157      this.densityGroupBox.Dock = System.Windows.Forms.DockStyle.Top;
    122158      this.densityGroupBox.Location = new System.Drawing.Point(0, 77);
     
    126162      this.densityGroupBox.TabStop = false;
    127163      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;
    209164      //
    210165      // columnsNumericUpDown
     
    228183      this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged);
    229184      //
     185      // columnsLabel
     186      //
     187      this.columnsLabel.AutoSize = true;
     188      this.columnsLabel.Location = new System.Drawing.Point(7, 49);
     189      this.columnsLabel.Name = "columnsLabel";
     190      this.columnsLabel.Size = new System.Drawing.Size(50, 13);
     191      this.columnsLabel.TabIndex = 0;
     192      this.columnsLabel.Text = "Columns:";
     193      //
     194      // densityComboBox
     195      //
     196      this.densityComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     197            | System.Windows.Forms.AnchorStyles.Right)));
     198      this.densityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     199      this.densityComboBox.FormattingEnabled = true;
     200      this.densityComboBox.Items.AddRange(new object[] {
     201            "None",
     202            "Training",
     203            "Test",
     204            "All"});
     205      this.densityComboBox.Location = new System.Drawing.Point(66, 19);
     206      this.densityComboBox.Name = "densityComboBox";
     207      this.densityComboBox.Size = new System.Drawing.Size(94, 21);
     208      this.densityComboBox.TabIndex = 0;
     209      this.densityComboBox.SelectedIndexChanged += new System.EventHandler(this.densityComboBox_SelectedIndexChanged);
     210      //
     211      // densityLabel
     212      //
     213      this.densityLabel.AutoSize = true;
     214      this.densityLabel.Location = new System.Drawing.Point(7, 22);
     215      this.densityLabel.Name = "densityLabel";
     216      this.densityLabel.Size = new System.Drawing.Size(45, 13);
     217      this.densityLabel.TabIndex = 0;
     218      this.densityLabel.Text = "Density:";
     219      //
     220      // yAxisConfigGroupBox
     221      //
     222      this.yAxisConfigGroupBox.Controls.Add(this.limitView);
     223      this.yAxisConfigGroupBox.Controls.Add(this.automaticYAxisCheckBox);
     224      this.yAxisConfigGroupBox.Dock = System.Windows.Forms.DockStyle.Top;
     225      this.yAxisConfigGroupBox.Location = new System.Drawing.Point(0, 0);
     226      this.yAxisConfigGroupBox.Name = "yAxisConfigGroupBox";
     227      this.yAxisConfigGroupBox.Size = new System.Drawing.Size(169, 77);
     228      this.yAxisConfigGroupBox.TabIndex = 2;
     229      this.yAxisConfigGroupBox.TabStop = false;
     230      this.yAxisConfigGroupBox.Text = "Y-Axis";
     231      //
     232      // limitView
     233      //
     234      this.limitView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     235            | System.Windows.Forms.AnchorStyles.Right)));
     236      this.limitView.Caption = "DoubleLimit View";
     237      this.limitView.Content = null;
     238      this.limitView.Location = new System.Drawing.Point(6, 20);
     239      this.limitView.Name = "limitView";
     240      this.limitView.ReadOnly = false;
     241      this.limitView.Size = new System.Drawing.Size(157, 47);
     242      this.limitView.TabIndex = 1;
     243      //
     244      // automaticYAxisCheckBox
     245      //
     246      this.automaticYAxisCheckBox.AutoSize = true;
     247      this.automaticYAxisCheckBox.Location = new System.Drawing.Point(49, -1);
     248      this.automaticYAxisCheckBox.Name = "automaticYAxisCheckBox";
     249      this.automaticYAxisCheckBox.Size = new System.Drawing.Size(73, 17);
     250      this.automaticYAxisCheckBox.TabIndex = 0;
     251      this.automaticYAxisCheckBox.Text = "Automatic";
     252      this.automaticYAxisCheckBox.UseVisualStyleBackColor = true;
     253      this.automaticYAxisCheckBox.CheckedChanged += new System.EventHandler(this.automaticYAxisCheckBox_CheckedChanged);
     254      //
     255      // scrollPanel
     256      //
     257      this.scrollPanel.Controls.Add(this.partialDependencePlotTableLayout);
     258      this.scrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     259      this.scrollPanel.Location = new System.Drawing.Point(0, 0);
     260      this.scrollPanel.Name = "scrollPanel";
     261      this.scrollPanel.Size = new System.Drawing.Size(542, 648);
     262      this.scrollPanel.TabIndex = 0;
     263      //
     264      // partialDependencePlotTableLayout
     265      //
     266      this.partialDependencePlotTableLayout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     267            | System.Windows.Forms.AnchorStyles.Right)));
     268      this.partialDependencePlotTableLayout.AutoSize = true;
     269      this.partialDependencePlotTableLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
     270      this.partialDependencePlotTableLayout.ColumnCount = 1;
     271      this.partialDependencePlotTableLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
     272      this.partialDependencePlotTableLayout.Location = new System.Drawing.Point(0, 0);
     273      this.partialDependencePlotTableLayout.Name = "partialDependencePlotTableLayout";
     274      this.partialDependencePlotTableLayout.RowCount = 1;
     275      this.partialDependencePlotTableLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
     276      this.partialDependencePlotTableLayout.Size = new System.Drawing.Size(542, 0);
     277      this.partialDependencePlotTableLayout.TabIndex = 2;
     278      //
     279      // errorProvider
     280      //
     281      this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     282      this.errorProvider.ContainerControl = this;
     283      //
    230284      // RegressionSolutionPartialDependencePlotView
    231285      //
     
    235289      this.Name = "RegressionSolutionPartialDependencePlotView";
    236290      this.Size = new System.Drawing.Size(715, 648);
    237       this.yAxisConfigGroupBox.ResumeLayout(false);
    238       this.yAxisConfigGroupBox.PerformLayout();
    239       this.densityGroupBox.ResumeLayout(false);
    240       this.densityGroupBox.PerformLayout();
    241291      this.configSplitContainer.Panel1.ResumeLayout(false);
    242292      this.configSplitContainer.Panel2.ResumeLayout(false);
     
    244294      this.configSplitContainer.ResumeLayout(false);
    245295      this.variableGroupBox.ResumeLayout(false);
     296      this.rowSelectGroupBox.ResumeLayout(false);
     297      this.rowSelectGroupBox.PerformLayout();
     298      ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).EndInit();
     299      this.densityGroupBox.ResumeLayout(false);
     300      this.densityGroupBox.PerformLayout();
     301      ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();
     302      this.yAxisConfigGroupBox.ResumeLayout(false);
     303      this.yAxisConfigGroupBox.PerformLayout();
    246304      this.scrollPanel.ResumeLayout(false);
    247305      this.scrollPanel.PerformLayout();
    248306      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    249       ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();
    250307      this.ResumeLayout(false);
    251308
     
    266323    private System.Windows.Forms.Label columnsLabel;
    267324    private System.Windows.Forms.ErrorProvider errorProvider;
    268     private System.Windows.Forms.Label label1;
     325    private System.Windows.Forms.Label densityLabel;
    269326    private System.Windows.Forms.NumericUpDown columnsNumericUpDown;
     327    private System.Windows.Forms.GroupBox rowSelectGroupBox;
     328    private System.Windows.Forms.ComboBox variableValuesModeComboBox;
     329    private System.Windows.Forms.Label rowLabel;
     330    private System.Windows.Forms.NumericUpDown rowNrNumericUpDown;
     331    private System.Windows.Forms.ToolTip toolTip;
    270332  }
    271333}
  • trunk/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs

    r15583 r16519  
    9797      var problemData = Content.ProblemData;
    9898
     99      if (sharedFixedVariables != null) {
     100        sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged;
     101        sharedFixedVariables.Reset -= SharedFixedVariables_Reset;
     102      }
     103
    99104      // Init Y-axis range
    100105      double min = double.MaxValue, max = double.MinValue;
     
    120125        Content.ProblemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).ToList();
    121126
    122 
    123127      var doubleVariables = allowedInputVariables.Where(problemData.Dataset.VariableHasType<double>);
    124       var doubleVariableValues = (IEnumerable<IList>)doubleVariables.Select(x => new List<double> { problemData.Dataset.GetDoubleValues(x, problemData.TrainingIndices).Median() });
     128      var doubleVariableValues = (IEnumerable<IList>)doubleVariables.Select(x => new List<double> {
     129        problemData.Dataset.GetDoubleValue(x, 0)
     130      });
    125131
    126132      var factorVariables = allowedInputVariables.Where(problemData.Dataset.VariableHasType<string>);
    127133      var factorVariableValues = (IEnumerable<IList>)factorVariables.Select(x => new List<string> {
    128         problemData.Dataset.GetStringValues(x, problemData.TrainingIndices)
    129         .GroupBy(val => val).OrderByDescending(g => g.Count()).First().Key // most frequent value
     134        problemData.Dataset.GetStringValue(x, 0)
    130135      });
    131136
    132       if (sharedFixedVariables != null)
    133         sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged;
    134 
    135137      sharedFixedVariables = new ModifiableDataset(doubleVariables.Concat(factorVariables), doubleVariableValues.Concat(factorVariableValues));
    136 
     138      variableValuesModeComboBox.SelectedItem = "Median"; // triggers UpdateVariableValue and changes shardFixedVariables
    137139
    138140      // create controls
     
    166168        };
    167169
    168         // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
     170        // Initially, the inner plot areas are not initialized for hidden charts (scrollpanel, ...)
    169171        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
    170172        plot.ChartPostPaint += OnPartialDependencePlotPostPaint;
     
    205207        };
    206208
    207         // Initially, the inner plot areas are not initialized for hidden charts (scollpanel, ...)
     209        // Initially, the inner plot areas are not initialized for hidden charts (scrollpanel, ...)
    208210        // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting.
    209211        plot.ChartPostPaint += OnFactorPartialDependencePlotPostPaint;
     
    230232
    231233      sharedFixedVariables.ItemChanged += SharedFixedVariables_ItemChanged;
     234      sharedFixedVariables.Reset += SharedFixedVariables_Reset;
     235
     236      rowNrNumericUpDown.Maximum = Content.ProblemData.Dataset.Rows - 1;
    232237
    233238      RecalculateAndRelayoutCharts();
     
    235240
    236241    private void SharedFixedVariables_ItemChanged(object sender, EventArgs<int, int> e) {
     242      SharedFixedVariablesChanged();
     243    }
     244    private void SharedFixedVariables_Reset(object sender, EventArgs e) {
     245      SharedFixedVariablesChanged();
     246    }
     247    private void SharedFixedVariablesChanged() {
     248      if (!setVariableValues) // set mode to "nothing" if change was not initiated from a "mode change"
     249        variableValuesModeComboBox.SelectedIndex = -1;
     250
    237251      double yValue = Content.Model.GetEstimatedValues(sharedFixedVariables, new[] { 0 }).Single();
    238252      string title = Content.ProblemData.TargetVariable + ": " + yValue.ToString("G5", CultureInfo.CurrentCulture);
     
    243257      }
    244258    }
    245 
    246259
    247260    private void OnPartialDependencePlotPostPaint(object o, EventArgs e) {
     
    564577      }
    565578    }
     579
     580    // flag that the current change is not triggered by a manual change from within a single plot
     581    private bool setVariableValues = false;
     582    private void variableValuesComboBox_SelectedValueChanged(object sender, EventArgs e) {
     583      if (variableValuesModeComboBox.SelectedIndex == -1)
     584        return; // changed to "manual" due to manual change of a variable
     585      setVariableValues = true;
     586      UpdateVariableValues();
     587      setVariableValues = false;
     588    }
     589    private void rowNrNumericUpDown_ValueChanged(object sender, EventArgs e) {
     590      if ((string)variableValuesModeComboBox.SelectedItem != "Row") {
     591        variableValuesModeComboBox.SelectedItem = "Row"; // triggers UpdateVariableValues
     592      } else {
     593        setVariableValues = true;
     594        UpdateVariableValues();
     595        setVariableValues = false;
     596      }
     597    }
     598    private void UpdateVariableValues() {
     599      string mode = (string)variableValuesModeComboBox.SelectedItem;
     600
     601      var dataset = Content.ProblemData.Dataset;
     602      object[] newRow;
     603
     604      if (mode == "Row") {
     605        int rowNumber = (int)rowNrNumericUpDown.Value;
     606        newRow = sharedFixedVariables.VariableNames
     607          .Select<string, object>(variableName => {
     608            if (dataset.DoubleVariables.Contains(variableName)) {
     609              return dataset.GetDoubleValue(variableName, rowNumber);
     610            } else if (dataset.StringVariables.Contains(variableName)) {
     611              return dataset.GetStringValue(variableName, rowNumber);
     612            } else {
     613              throw new NotSupportedException("Only double and string(factor) columns are currently supported.");
     614            }
     615          }).ToArray();
     616      } else {
     617        newRow = sharedFixedVariables.VariableNames
     618          .Select<string, object>(variableName => {
     619            if (dataset.DoubleVariables.Contains(variableName)) {
     620              var values = dataset.GetDoubleValues(variableName);
     621              return
     622                mode == "Mean" ? values.Average() :
     623                mode == "Median" ? values.Median() :
     624                mode == "Most Common" ? MostCommon(values) :
     625                throw new NotSupportedException();
     626            } else if (dataset.StringVariables.Contains(variableName)) {
     627              var values = dataset.GetStringValues(variableName);
     628              return
     629                mode == "Mean" ? MostCommon(values) :
     630                mode == "Median" ? MostCommon(values) :
     631                mode == "Most Common" ? MostCommon(values) :
     632                throw new NotSupportedException();
     633            } else {
     634              throw new NotSupportedException("Only double and string(factor) columns are currently supported.");
     635            }
     636          }).ToArray();
     637      }
     638
     639      sharedFixedVariables.ReplaceRow(0, newRow);
     640    }
     641
     642    private static T MostCommon<T>(IEnumerable<T> values) {
     643      return values.GroupBy(x => x).OrderByDescending(g => g.Count()).Select(g => g.Key).First();
     644    }
     645
     646    // ToolTips cannot be shown longer than 5000ms, only by using ToolTip.Show manually
     647    // See: https://stackoverflow.com/questions/8225807/c-sharp-tooltip-doesnt-display-long-enough
     648    private void variableValuesModeComboBox_MouseHover(object sender, EventArgs e) {
     649      string tooltipText = @"Sets each variable to a specific value:
     650    Row - Selects the value based on a specified row of the dataset.
     651    Mean - Sets the value to the arithmetic mean of the variable.
     652    Median - Sets the value to the median of the variable.
     653    Most Common - Sets the value to the most common value of the variable (first if multiple).
     654
     655Note: For categorical values, the most common value is used when selecting Mean, Median or Most Common.";
     656      toolTip.Show(tooltipText, variableValuesModeComboBox, 30000);
     657      toolTip.Active = true;
     658    }
     659    private void variableValuesModeComboBox_MouseLeave(object sender, EventArgs e) {
     660      toolTip.Active = false;
     661    }
    566662  }
    567663}
  • trunk/HeuristicLab.Problems.QuadraticAssignment.Views

  • trunk/HeuristicLab.Problems.TravelingSalesman.Views

  • trunk/HeuristicLab.Problems.VehicleRouting.Views

  • trunk/HeuristicLab.Random

  • trunk/HeuristicLab.Tests

Note: See TracChangeset for help on using the changeset viewer.