Changeset 16445
- Timestamp:
- 12/21/18 15:37:44 (6 years ago)
- 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 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) { } catch (AggregateException ae) { 223 225 if (!ae.InnerExceptions.Any(e => e is OperationCanceledException)) 224 226 throw; … … 495 497 } 496 498 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 497 507 private async void chart_DragDrop(object sender, DragEventArgs e) { 498 508 var data = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); -
branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Controls/PartialDependencePlot.cs
r15845 r16445 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) { } catch (AggregateException ae) { 319 321 if (!ae.InnerExceptions.Any(e => e is OperationCanceledException)) 320 322 throw; … … 625 627 626 628 var variableName = variables[columnIndex]; 627 if (variableName == FreeVariable) return; 629 if (variableName == FreeVariable) { 630 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; -
branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Interfaces/IPartialDependencePlot.cs
r15583 r16445 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; } -
branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.Designer.cs
r14852 r16445 31 31 this.automaticYAxisCheckBox = new System.Windows.Forms.CheckBox(); 32 32 this.densityGroupBox = new System.Windows.Forms.GroupBox(); 33 this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 33 34 this.columnsLabel = new System.Windows.Forms.Label(); 34 35 this.densityComboBox = new System.Windows.Forms.ComboBox(); … … 36 37 this.configSplitContainer = new System.Windows.Forms.SplitContainer(); 37 38 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(); 38 43 this.scrollPanel = new System.Windows.Forms.Panel(); 39 44 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 40 this.columnsNumericUpDown = new System.Windows.Forms.NumericUpDown();41 45 this.yAxisConfigGroupBox.SuspendLayout(); 42 46 this.densityGroupBox.SuspendLayout(); 47 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit(); 43 48 ((System.ComponentModel.ISupportInitialize)(this.configSplitContainer)).BeginInit(); 44 49 this.configSplitContainer.Panel1.SuspendLayout(); … … 46 51 this.configSplitContainer.SuspendLayout(); 47 52 this.variableGroupBox.SuspendLayout(); 53 this.rowSelectGroupBox.SuspendLayout(); 54 ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).BeginInit(); 48 55 this.scrollPanel.SuspendLayout(); 49 56 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 50 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).BeginInit();51 57 this.SuspendLayout(); 52 58 // … … 57 63 this.variableListView.Location = new System.Drawing.Point(3, 16); 58 64 this.variableListView.Name = "variableListView"; 59 this.variableListView.Size = new System.Drawing.Size(163, 4 78);65 this.variableListView.Size = new System.Drawing.Size(163, 404); 60 66 this.variableListView.TabIndex = 0; 61 67 this.variableListView.UseCompatibleStateImageBehavior = false; … … 126 132 this.densityGroupBox.TabStop = false; 127 133 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 134 // 210 135 // columnsNumericUpDown … … 228 153 this.columnsNumericUpDown.ValueChanged += new System.EventHandler(this.columnsNumericUpDown_ValueChanged); 229 154 // 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 // 230 280 // RegressionSolutionPartialDependencePlotView 231 281 // … … 239 289 this.densityGroupBox.ResumeLayout(false); 240 290 this.densityGroupBox.PerformLayout(); 291 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit(); 241 292 this.configSplitContainer.Panel1.ResumeLayout(false); 242 293 this.configSplitContainer.Panel2.ResumeLayout(false); … … 244 295 this.configSplitContainer.ResumeLayout(false); 245 296 this.variableGroupBox.ResumeLayout(false); 297 this.rowSelectGroupBox.ResumeLayout(false); 298 this.rowSelectGroupBox.PerformLayout(); 299 ((System.ComponentModel.ISupportInitialize)(this.rowNrNumericUpDown)).EndInit(); 246 300 this.scrollPanel.ResumeLayout(false); 247 301 this.scrollPanel.PerformLayout(); 248 302 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 249 ((System.ComponentModel.ISupportInitialize)(this.columnsNumericUpDown)).EndInit();250 303 this.ResumeLayout(false); 251 304 … … 268 321 private System.Windows.Forms.Label label1; 269 322 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; 270 327 } 271 328 } -
branches/2972_PDPRowSelect/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionPartialDependencePlotView.cs
r15583 r16445 231 231 sharedFixedVariables.ItemChanged += SharedFixedVariables_ItemChanged; 232 232 233 rowNrNumericUpDown.Maximum = Content.ProblemData.Dataset.Rows - 1; 234 233 235 RecalculateAndRelayoutCharts(); 234 236 } … … 564 566 } 565 567 } 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 } 566 586 } 567 587 }
Note: See TracChangeset
for help on using the changeset viewer.