Changeset 16833
- Timestamp:
- 04/19/19 09:41:14 (6 years ago)
- Location:
- stable
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/branches/2972_PDPRowSelect (added) merged: 16444-16445,16516-16518 /trunk merged: 16519
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/FactorPartialDependencePlot.cs
r16162 r16833 167 167 // add an event such that whenever a value is changed in the shared dataset, 168 168 // 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) { 170 170 this.sharedFixedVariables.ItemChanged -= sharedFixedVariables_ItemChanged; 171 this.sharedFixedVariables.Reset -= sharedFixedVariables_Reset; 172 } 173 171 174 this.sharedFixedVariables = sharedFixedVariables; 172 175 this.sharedFixedVariables.ItemChanged += sharedFixedVariables_ItemChanged; 176 this.sharedFixedVariables.Reset += sharedFixedVariables_Reset; 173 177 174 178 RecalculateInternalDataset(); … … 218 222 if (updateOnFinish) 219 223 Update(); 220 } 221 catch (OperationCanceledException) { } 222 catch (AggregateException ae) { 224 } catch (OperationCanceledException) { 225 } catch (AggregateException ae) { 223 226 if (!ae.InnerExceptions.Any(e => e is OperationCanceledException)) 224 227 throw; … … 495 498 } 496 499 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 497 508 private async void chart_DragDrop(object sender, DragEventArgs e) { 498 509 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs
r16425 r16833 245 245 // add an event such that whenever a value is changed in the shared dataset, 246 246 // 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) { 248 248 this.sharedFixedVariables.ItemChanged -= sharedFixedVariables_ItemChanged; 249 this.sharedFixedVariables.Reset -= sharedFixedVariables_Reset; 250 } 251 249 252 this.sharedFixedVariables = sharedFixedVariables; 250 253 this.sharedFixedVariables.ItemChanged += sharedFixedVariables_ItemChanged; 254 this.sharedFixedVariables.Reset += sharedFixedVariables_Reset; 251 255 252 256 RecalculateTrainingLimits(initializeAxisRanges); … … 314 318 if (updateOnFinish) 315 319 Update(); 316 } 317 catch (OperationCanceledException) { } 318 catch (AggregateException ae) { 320 } catch (OperationCanceledException) { 321 } catch (AggregateException ae) { 319 322 if (!ae.InnerExceptions.Any(e => e is OperationCanceledException)) 320 323 throw; … … 626 629 var variableName = variables[columnIndex]; 627 630 if (variableName == FreeVariable) return; 631 628 632 if (internalDataset.VariableHasType<double>(variableName)) { 629 633 var v = sharedFixedVariables.GetDoubleValue(variableName, rowIndex); … … 640 644 } 641 645 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 642 652 private void chart_AnnotationPositionChanging(object sender, AnnotationPositionChangingEventArgs e) { 643 653 var step = (trainingMax - trainingMin) / drawingSteps; … … 658 668 private void UpdateCursor() { 659 669 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); 661 673 662 674 if (ShowCursor) { -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IPartialDependencePlot.cs
r15584 r16833 25 25 public interface IPartialDependencePlot { 26 26 Task RecalculateAsync(bool updateOnFinish, bool resetYAxis); 27 double YMin { get; 27 double YMin { get; } 28 28 double YMax { get; } 29 29 double? FixedYAxisMin { get; set; } -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs
r15137 r16833 25 25 private void InitializeComponent() { 26 26 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(); 27 30 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(); 29 39 this.yAxisConfigGroupBox = new System.Windows.Forms.GroupBox(); 30 40 this.limitView = new HeuristicLab.Problems.DataAnalysis.Views.DoubleLimitView(); 31 41 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();38 42 this.scrollPanel = new System.Windows.Forms.Panel(); 43 this.partialDependencePlotTableLayout = new System.Windows.Forms.TableLayoutPanel(); 39 44 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); 43 46 ((System.ComponentModel.ISupportInitialize)(this.configSplitContainer)).BeginInit(); 44 47 this.configSplitContainer.Panel1.SuspendLayout(); … … 46 49 this.configSplitContainer.SuspendLayout(); 47 50 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(); 48 56 this.scrollPanel.SuspendLayout(); 49 57 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 50 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();51 58 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"; 52 108 // 53 109 // variableListView … … 57 113 this.variableListView.Location = new System.Drawing.Point(3, 16); 58 114 this.variableListView.Name = "variableListView"; 59 this.variableListView.Size = new System.Drawing.Size(163, 4 78);115 this.variableListView.Size = new System.Drawing.Size(163, 404); 60 116 this.variableListView.TabIndex = 0; 61 117 this.variableListView.UseCompatibleStateImageBehavior = false; … … 63 119 this.variableListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.variableListView_ItemChecked); 64 120 // 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); 114 150 // 115 151 // densityGroupBox … … 118 154 this.densityGroupBox.Controls.Add(this.columnsLabel); 119 155 this.densityGroupBox.Controls.Add(this.densityComboBox); 120 this.densityGroupBox.Controls.Add(this. label1);156 this.densityGroupBox.Controls.Add(this.densityLabel); 121 157 this.densityGroupBox.Dock = System.Windows.Forms.DockStyle.Top; 122 158 this.densityGroupBox.Location = new System.Drawing.Point(0, 77); … … 126 162 this.densityGroupBox.TabStop = false; 127 163 this.densityGroupBox.Text = "Settings"; 128 //129 // columnsLabel130 //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 // densityComboBox139 //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 // label1156 //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 // configSplitContainer165 //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.Panel1172 //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.Panel2178 //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 // variableGroupBox186 //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 // scrollPanel197 //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 // errorProvider206 //207 this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;208 this.errorProvider.ContainerControl = this;209 164 // 210 165 // columnsNumericUpDown … … 228 183 this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged); 229 184 // 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 // 230 284 // RegressionSolutionPartialDependencePlotView 231 285 // … … 235 289 this.Name = "RegressionSolutionPartialDependencePlotView"; 236 290 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();241 291 this.configSplitContainer.Panel1.ResumeLayout(false); 242 292 this.configSplitContainer.Panel2.ResumeLayout(false); … … 244 294 this.configSplitContainer.ResumeLayout(false); 245 295 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(); 246 304 this.scrollPanel.ResumeLayout(false); 247 305 this.scrollPanel.PerformLayout(); 248 306 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 249 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();250 307 this.ResumeLayout(false); 251 308 … … 266 323 private System.Windows.Forms.Label columnsLabel; 267 324 private System.Windows.Forms.ErrorProvider errorProvider; 268 private System.Windows.Forms.Label label1;325 private System.Windows.Forms.Label densityLabel; 269 326 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; 270 332 } 271 333 } -
stable/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs
r15584 r16833 97 97 var problemData = Content.ProblemData; 98 98 99 if (sharedFixedVariables != null) { 100 sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged; 101 sharedFixedVariables.Reset -= SharedFixedVariables_Reset; 102 } 103 99 104 // Init Y-axis range 100 105 double min = double.MaxValue, max = double.MinValue; … … 120 125 Content.ProblemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).ToList(); 121 126 122 123 127 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 }); 125 131 126 132 var factorVariables = allowedInputVariables.Where(problemData.Dataset.VariableHasType<string>); 127 133 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) 130 135 }); 131 136 132 if (sharedFixedVariables != null)133 sharedFixedVariables.ItemChanged -= SharedFixedVariables_ItemChanged;134 135 137 sharedFixedVariables = new ModifiableDataset(doubleVariables.Concat(factorVariables), doubleVariableValues.Concat(factorVariableValues)); 136 138 variableValuesModeComboBox.SelectedItem = "Median"; // triggers UpdateVariableValue and changes shardFixedVariables 137 139 138 140 // create controls … … 166 168 }; 167 169 168 // Initially, the inner plot areas are not initialized for hidden charts (sc ollpanel, ...)170 // Initially, the inner plot areas are not initialized for hidden charts (scrollpanel, ...) 169 171 // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting. 170 172 plot.ChartPostPaint += OnPartialDependencePlotPostPaint; … … 205 207 }; 206 208 207 // Initially, the inner plot areas are not initialized for hidden charts (sc ollpanel, ...)209 // Initially, the inner plot areas are not initialized for hidden charts (scrollpanel, ...) 208 210 // This event handler listens for the paint event once (where everything is already initialized) to do some manual layouting. 209 211 plot.ChartPostPaint += OnFactorPartialDependencePlotPostPaint; … … 230 232 231 233 sharedFixedVariables.ItemChanged += SharedFixedVariables_ItemChanged; 234 sharedFixedVariables.Reset += SharedFixedVariables_Reset; 235 236 rowNrNumericUpDown.Maximum = Content.ProblemData.Dataset.Rows - 1; 232 237 233 238 RecalculateAndRelayoutCharts(); … … 235 240 236 241 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 237 251 double yValue = Content.Model.GetEstimatedValues(sharedFixedVariables, new[] { 0 }).Single(); 238 252 string title = Content.ProblemData.TargetVariable + ": " + yValue.ToString("G5", CultureInfo.CurrentCulture); … … 243 257 } 244 258 } 245 246 259 247 260 private void OnPartialDependencePlotPostPaint(object o, EventArgs e) { … … 564 577 } 565 578 } 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 655 Note: 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 } 566 662 } 567 663 }
Note: See TracChangeset
for help on using the changeset viewer.