Changeset 12800
- Timestamp:
- 07/22/15 16:20:26 (9 years ago)
- Location:
- branches/crossvalidation-2434
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.Designer.cs
r12012 r12800 46 46 /// </summary> 47 47 private void InitializeComponent() { 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CrossValidationView)); 48 49 this.startButton = new System.Windows.Forms.Button(); 49 50 this.pauseButton = new System.Windows.Forms.Button(); … … 79 80 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 80 81 this.splitContainer = new System.Windows.Forms.SplitContainer(); 82 this.partitionVariableComboBox = new System.Windows.Forms.ComboBox(); 83 this.partitionVariableLabel = new System.Windows.Forms.Label(); 81 84 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 82 85 ((System.ComponentModel.ISupportInitialize)(this.foldsNumericUpDown)).BeginInit(); … … 109 112 // 110 113 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 111 this.startButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Play;114 this.startButton.Image = ((System.Drawing.Image)(resources.GetObject("startButton.Image"))); 112 115 this.startButton.Location = new System.Drawing.Point(0, 514); 113 116 this.startButton.Name = "startButton"; … … 120 123 // 121 124 this.pauseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 122 this.pauseButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Pause;125 this.pauseButton.Image = ((System.Drawing.Image)(resources.GetObject("pauseButton.Image"))); 123 126 this.pauseButton.Location = new System.Drawing.Point(30, 514); 124 127 this.pauseButton.Name = "pauseButton"; … … 131 134 // 132 135 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 133 this.stopButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Stop;136 this.stopButton.Image = ((System.Drawing.Image)(resources.GetObject("stopButton.Image"))); 134 137 this.stopButton.Location = new System.Drawing.Point(60, 514); 135 138 this.stopButton.Name = "stopButton"; … … 142 145 // 143 146 this.resetButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 144 this.resetButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Restart;147 this.resetButton.Image = ((System.Drawing.Image)(resources.GetObject("resetButton.Image"))); 145 148 this.resetButton.Location = new System.Drawing.Point(90, 514); 146 149 this.resetButton.Name = "resetButton"; … … 171 174 // foldsNumericUpDown 172 175 // 173 this.foldsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 174 175 this.foldsNumericUpDown.Location = new System.Drawing.Point( 55, 26);176 this.foldsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 177 | System.Windows.Forms.AnchorStyles.Right))); 178 this.foldsNumericUpDown.Location = new System.Drawing.Point(62, 26); 176 179 this.foldsNumericUpDown.Maximum = new decimal(new int[] { 177 180 50, … … 185 188 0}); 186 189 this.foldsNumericUpDown.Name = "foldsNumericUpDown"; 187 this.foldsNumericUpDown.Size = new System.Drawing.Size(24 8, 20);190 this.foldsNumericUpDown.Size = new System.Drawing.Size(241, 20); 188 191 this.foldsNumericUpDown.TabIndex = 3; 189 192 this.foldsNumericUpDown.ThousandsSeparator = true; … … 207 210 // workersNumericUpDown 208 211 // 209 this.workersNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 210 211 this.workersNumericUpDown.Location = new System.Drawing.Point( 55, 0);212 this.workersNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 213 | System.Windows.Forms.AnchorStyles.Right))); 214 this.workersNumericUpDown.Location = new System.Drawing.Point(62, 0); 212 215 this.workersNumericUpDown.Maximum = new decimal(new int[] { 213 216 50, … … 221 224 0}); 222 225 this.workersNumericUpDown.Name = "workersNumericUpDown"; 223 this.workersNumericUpDown.Size = new System.Drawing.Size(24 8, 20);226 this.workersNumericUpDown.Size = new System.Drawing.Size(241, 20); 224 227 this.workersNumericUpDown.TabIndex = 1; 225 228 this.workersNumericUpDown.ThousandsSeparator = true; … … 248 251 this.samplesStartLabel.Size = new System.Drawing.Size(75, 13); 249 252 this.samplesStartLabel.TabIndex = 0; 250 this.samplesStartLabel.Text = " &SamplesStart:";253 this.samplesStartLabel.Text = "Samples &Start:"; 251 254 // 252 255 // samplesEndLabel … … 257 260 this.samplesEndLabel.Size = new System.Drawing.Size(72, 13); 258 261 this.samplesEndLabel.TabIndex = 2; 259 this.samplesEndLabel.Text = " &SamplesEnd:";262 this.samplesEndLabel.Text = "Samples &End:"; 260 263 // 261 264 // samplesEndStringConvertibleValueView 262 265 // 263 this.samplesEndStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 264 266 this.samplesEndStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 267 | System.Windows.Forms.AnchorStyles.Right))); 265 268 this.samplesEndStringConvertibleValueView.Caption = "StringConvertibleValue View"; 266 269 this.samplesEndStringConvertibleValueView.Content = null; … … 274 277 // samplesStartStringConvertibleValueView 275 278 // 276 this.samplesStartStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 277 279 this.samplesStartStringConvertibleValueView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 280 | System.Windows.Forms.AnchorStyles.Right))); 278 281 this.samplesStartStringConvertibleValueView.Caption = "StringConvertibleValue View"; 279 282 this.samplesStartStringConvertibleValueView.Content = null; … … 288 291 // 289 292 this.tabControl.AllowDrop = true; 290 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 291 | System.Windows.Forms.AnchorStyles.Left)292 293 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 294 | System.Windows.Forms.AnchorStyles.Left) 295 | System.Windows.Forms.AnchorStyles.Right))); 293 296 this.tabControl.Controls.Add(this.algorithmTabPage); 294 297 this.tabControl.Controls.Add(this.resultsTabPage); 295 298 this.tabControl.Controls.Add(this.runsTabPage); 296 this.tabControl.Location = new System.Drawing.Point(0, 87);299 this.tabControl.Location = new System.Drawing.Point(0, 109); 297 300 this.tabControl.Name = "tabControl"; 298 301 this.tabControl.SelectedIndex = 0; 299 this.tabControl.Size = new System.Drawing.Size(616, 421);300 this.tabControl.TabIndex = 4;302 this.tabControl.Size = new System.Drawing.Size(616, 399); 303 this.tabControl.TabIndex = 5; 301 304 // 302 305 // algorithmTabPage … … 310 313 this.algorithmTabPage.Name = "algorithmTabPage"; 311 314 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3); 312 this.algorithmTabPage.Size = new System.Drawing.Size(608, 3 95);315 this.algorithmTabPage.Size = new System.Drawing.Size(608, 373); 313 316 this.algorithmTabPage.TabIndex = 0; 314 317 this.algorithmTabPage.Text = "Algorithm"; … … 320 323 // algorithmNamedItemView 321 324 // 322 this.algorithmNamedItemView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 323 325 this.algorithmNamedItemView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 326 | System.Windows.Forms.AnchorStyles.Right))); 324 327 this.algorithmNamedItemView.Caption = "NamedItem View"; 325 328 this.algorithmNamedItemView.Content = null; … … 333 336 // 334 337 this.algorithmTabControl.AllowDrop = true; 335 this.algorithmTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 336 | System.Windows.Forms.AnchorStyles.Left)337 338 this.algorithmTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 339 | System.Windows.Forms.AnchorStyles.Left) 340 | System.Windows.Forms.AnchorStyles.Right))); 338 341 this.algorithmTabControl.Controls.Add(this.algorithmProblemTabPage); 339 342 this.algorithmTabControl.Controls.Add(this.algorithmParametersTabPage); … … 341 344 this.algorithmTabControl.Name = "algorithmTabControl"; 342 345 this.algorithmTabControl.SelectedIndex = 0; 343 this.algorithmTabControl.Size = new System.Drawing.Size(594, 3 24);346 this.algorithmTabControl.Size = new System.Drawing.Size(594, 302); 344 347 this.algorithmTabControl.TabIndex = 3; 345 348 // … … 353 356 this.algorithmProblemTabPage.Name = "algorithmProblemTabPage"; 354 357 this.algorithmProblemTabPage.Padding = new System.Windows.Forms.Padding(3); 355 this.algorithmProblemTabPage.Size = new System.Drawing.Size(586, 2 98);358 this.algorithmProblemTabPage.Size = new System.Drawing.Size(586, 276); 356 359 this.algorithmProblemTabPage.TabIndex = 0; 357 360 this.algorithmProblemTabPage.Text = "Problem"; … … 363 366 // openProblemButton 364 367 // 365 this.openProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open;368 this.openProblemButton.Image = ((System.Drawing.Image)(resources.GetObject("openProblemButton.Image"))); 366 369 this.openProblemButton.Location = new System.Drawing.Point(36, 6); 367 370 this.openProblemButton.Name = "openProblemButton"; … … 374 377 // algorithmProblemViewHost 375 378 // 376 this.algorithmProblemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 377 | System.Windows.Forms.AnchorStyles.Left)378 379 this.algorithmProblemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 380 | System.Windows.Forms.AnchorStyles.Left) 381 | System.Windows.Forms.AnchorStyles.Right))); 379 382 this.algorithmProblemViewHost.Caption = "View"; 380 383 this.algorithmProblemViewHost.Content = null; … … 383 386 this.algorithmProblemViewHost.Name = "algorithmProblemViewHost"; 384 387 this.algorithmProblemViewHost.ReadOnly = false; 385 this.algorithmProblemViewHost.Size = new System.Drawing.Size(574, 2 56);388 this.algorithmProblemViewHost.Size = new System.Drawing.Size(574, 234); 386 389 this.algorithmProblemViewHost.TabIndex = 2; 387 390 this.algorithmProblemViewHost.ViewsLabelVisible = true; … … 390 393 // newProblemButton 391 394 // 392 this.newProblemButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;395 this.newProblemButton.Image = ((System.Drawing.Image)(resources.GetObject("newProblemButton.Image"))); 393 396 this.newProblemButton.Location = new System.Drawing.Point(6, 6); 394 397 this.newProblemButton.Name = "newProblemButton"; … … 405 408 this.algorithmParametersTabPage.Name = "algorithmParametersTabPage"; 406 409 this.algorithmParametersTabPage.Padding = new System.Windows.Forms.Padding(3); 407 this.algorithmParametersTabPage.Size = new System.Drawing.Size(586, 2 98);410 this.algorithmParametersTabPage.Size = new System.Drawing.Size(586, 276); 408 411 this.algorithmParametersTabPage.TabIndex = 1; 409 412 this.algorithmParametersTabPage.Text = "Parameters"; … … 412 415 // algorithmParameterCollectionView 413 416 // 417 this.algorithmParameterCollectionView.AllowEditingOfHiddenParameters = true; 414 418 this.algorithmParameterCollectionView.Caption = "ParameterCollection View"; 415 419 this.algorithmParameterCollectionView.Content = null; … … 418 422 this.algorithmParameterCollectionView.Name = "algorithmParameterCollectionView"; 419 423 this.algorithmParameterCollectionView.ReadOnly = false; 420 this.algorithmParameterCollectionView.Size = new System.Drawing.Size(580, 292); 424 this.algorithmParameterCollectionView.ShowDetails = true; 425 this.algorithmParameterCollectionView.Size = new System.Drawing.Size(580, 270); 421 426 this.algorithmParameterCollectionView.TabIndex = 0; 422 427 // 423 428 // openAlgorithmButton 424 429 // 425 this.openAlgorithmButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Open;430 this.openAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("openAlgorithmButton.Image"))); 426 431 this.openAlgorithmButton.Location = new System.Drawing.Point(38, 6); 427 432 this.openAlgorithmButton.Name = "openAlgorithmButton"; … … 434 439 // newAlgorithmButton 435 440 // 436 this.newAlgorithmButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.NewDocument;441 this.newAlgorithmButton.Image = ((System.Drawing.Image)(resources.GetObject("newAlgorithmButton.Image"))); 437 442 this.newAlgorithmButton.Location = new System.Drawing.Point(8, 6); 438 443 this.newAlgorithmButton.Name = "newAlgorithmButton"; … … 449 454 this.resultsTabPage.Name = "resultsTabPage"; 450 455 this.resultsTabPage.Padding = new System.Windows.Forms.Padding(3); 451 this.resultsTabPage.Size = new System.Drawing.Size(608, 3 95);456 this.resultsTabPage.Size = new System.Drawing.Size(608, 373); 452 457 this.resultsTabPage.TabIndex = 1; 453 458 this.resultsTabPage.Text = "Results"; … … 462 467 this.resultCollectionView.Name = "resultCollectionView"; 463 468 this.resultCollectionView.ReadOnly = true; 464 this.resultCollectionView.Size = new System.Drawing.Size(602, 389); 469 this.resultCollectionView.ShowDetails = true; 470 this.resultCollectionView.Size = new System.Drawing.Size(602, 367); 465 471 this.resultCollectionView.TabIndex = 0; 466 472 // … … 472 478 this.runsTabPage.Name = "runsTabPage"; 473 479 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 474 this.runsTabPage.Size = new System.Drawing.Size(608, 3 95);480 this.runsTabPage.Size = new System.Drawing.Size(608, 373); 475 481 this.runsTabPage.TabIndex = 2; 476 482 this.runsTabPage.Text = "Runs"; … … 501 507 this.runCollectionView.Name = "runCollectionView"; 502 508 this.runCollectionView.ReadOnly = false; 503 this.runCollectionView.Size = new System.Drawing.Size(602, 3 89);509 this.runCollectionView.Size = new System.Drawing.Size(602, 367); 504 510 this.runCollectionView.TabIndex = 0; 505 511 // … … 513 519 // splitContainer 514 520 // 515 this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 516 521 this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 522 | System.Windows.Forms.AnchorStyles.Right))); 517 523 this.splitContainer.Location = new System.Drawing.Point(0, 26); 518 524 this.splitContainer.Name = "splitContainer"; … … 527 533 // splitContainer.Panel2 528 534 // 535 this.splitContainer.Panel2.Controls.Add(this.partitionVariableComboBox); 536 this.splitContainer.Panel2.Controls.Add(this.partitionVariableLabel); 529 537 this.splitContainer.Panel2.Controls.Add(this.foldsNumericUpDown); 530 538 this.splitContainer.Panel2.Controls.Add(this.foldsLabel); 531 539 this.splitContainer.Panel2.Controls.Add(this.workersLabel); 532 540 this.splitContainer.Panel2.Controls.Add(this.workersNumericUpDown); 533 this.splitContainer.Size = new System.Drawing.Size(616, 55);541 this.splitContainer.Size = new System.Drawing.Size(616, 77); 534 542 this.splitContainer.SplitterDistance = 306; 535 543 this.splitContainer.TabIndex = 3; 536 544 // 545 // partitionVariableComboBox 546 // 547 this.partitionVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 548 | System.Windows.Forms.AnchorStyles.Right))); 549 this.partitionVariableComboBox.FormattingEnabled = true; 550 this.partitionVariableComboBox.Items.AddRange(new object[] { 551 "<none>"}); 552 this.partitionVariableComboBox.Location = new System.Drawing.Point(62, 52); 553 this.partitionVariableComboBox.Name = "partitionVariableComboBox"; 554 this.partitionVariableComboBox.Size = new System.Drawing.Size(241, 21); 555 this.partitionVariableComboBox.TabIndex = 4; 556 this.partitionVariableComboBox.SelectionChangeCommitted += new System.EventHandler(this.partitionVariableComboBox_SelectionChangeCommitted); 557 // 558 // partitionVariableLabel 559 // 560 this.partitionVariableLabel.AutoSize = true; 561 this.partitionVariableLabel.Location = new System.Drawing.Point(3, 55); 562 this.partitionVariableLabel.Name = "partitionVariableLabel"; 563 this.partitionVariableLabel.Size = new System.Drawing.Size(53, 13); 564 this.partitionVariableLabel.TabIndex = 4; 565 this.partitionVariableLabel.Text = "&Partitions:"; 566 // 537 567 // CrossValidationView 538 568 // 539 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);540 569 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 541 570 this.Controls.Add(this.tabControl); … … 617 646 private System.Windows.Forms.SplitContainer splitContainer; 618 647 private Optimization.Views.ResultCollectionView resultCollectionView; 648 private System.Windows.Forms.ComboBox partitionVariableComboBox; 649 private System.Windows.Forms.Label partitionVariableLabel; 619 650 } 620 651 } -
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs
r12012 r12800 64 64 Locked = ReadOnly = Content.ExecutionState == ExecutionState.Started; 65 65 workersNumericUpDown.Value = Content.NumberOfWorkers.Value; 66 foldsNumericUpDown.Value = Content.Folds .Value;66 foldsNumericUpDown.Value = Content.Folds; 67 67 samplesStartStringConvertibleValueView.Content = Content.SamplesStart; 68 68 samplesEndStringConvertibleValueView.Content = Content.SamplesEnd; … … 81 81 Content.AlgorithmChanged += new EventHandler(Content_AlgorithmChanged); 82 82 Content.ProblemChanged += new EventHandler(Content_ProblemChanged); 83 Content.Folds.ValueChanged += new EventHandler(Content_Folds_ValueChanged); 83 if (Content.Problem != null) Content.Problem.Reset += Content_ProblemReset; 84 Content.FoldsChanged += Content_FoldsChanged; 84 85 Content.NumberOfWorkers.ValueChanged += new EventHandler(Content_NumberOfWorker_ValueChanged); 85 86 … … 93 94 Content.AlgorithmChanged -= new EventHandler(Content_AlgorithmChanged); 94 95 Content.ProblemChanged -= new EventHandler(Content_ProblemChanged); 95 Content.Folds.ValueChanged -= new EventHandler(Content_Folds_ValueChanged); 96 if (Content.Problem != null) Content.Problem.Reset -= Content_ProblemReset; 97 Content.FoldsChanged -= Content_FoldsChanged; 96 98 Content.NumberOfWorkers.ValueChanged -= new EventHandler(Content_NumberOfWorker_ValueChanged); 97 99 … … 132 134 samplesEndStringConvertibleValueView.Enabled = Content.ExecutionState == ExecutionState.Prepared; 133 135 workersNumericUpDown.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); 136 partitionVariableLabel.Enabled = (Content.ExecutionState == ExecutionState.Prepared); 137 partitionVariableComboBox.Enabled = (Content.ExecutionState == ExecutionState.Prepared); 134 138 135 139 startButton.Enabled = (Content.ExecutionState == ExecutionState.Prepared) || (Content.ExecutionState == ExecutionState.Paused); … … 144 148 private void Content_AlgorithmChanged(object sender, EventArgs e) { 145 149 UpdateAlgorithmView(); 150 UpdateFolds(); 146 151 UpdateProblemView(); 147 152 SetEnabledStateOfControls(); 148 153 } 149 154 private void UpdateAlgorithmView() { 150 algorithmNamedItemView.Content = Content.Algorithm; 151 UpdateProblemView(); 155 if (InvokeRequired) Invoke((Action)UpdateAlgorithmView); 156 else { 157 algorithmNamedItemView.Content = Content.Algorithm; 158 UpdateProblemView(); 159 } 152 160 } 153 161 154 162 private void Content_ProblemChanged(object sender, EventArgs e) { 163 if (Content.Problem != null) Content.Problem.Reset += Content_ProblemReset; 164 UpdateFolds(); 155 165 UpdateProblemView(); 156 166 SetEnabledStateOfControls(); 157 167 } 168 169 private void Content_ProblemReset(object sender, EventArgs e) { 170 UpdateFolds(); 171 } 172 173 158 174 private void UpdateProblemView() { 159 algorithmProblemViewHost.Content = Content.Problem; 160 } 161 162 private void Content_Folds_ValueChanged(object sender, EventArgs e) { 163 foldsNumericUpDown.Value = Content.Folds.Value; 164 } 175 if (InvokeRequired) Invoke((Action)UpdateProblemView); 176 else { 177 algorithmProblemViewHost.Content = Content.Problem; 178 } 179 } 180 181 private void Content_FoldsChanged(object sender, EventArgs e) { 182 UpdateFolds(); 183 } 184 185 private bool disableUpdateToContent = false; // to prevent changing Content.Folds or Content.PartitionVariable while updating the GUI from the content 186 private void UpdateFolds() { 187 if (InvokeRequired) Invoke((Action)UpdateFolds); 188 else { 189 disableUpdateToContent = true; 190 foldsNumericUpDown.Value = Content.Folds; 191 192 partitionVariableComboBox.BeginUpdate(); 193 partitionVariableComboBox.Items.Clear(); 194 partitionVariableComboBox.Items.Add(CrossValidation.NoPartitionVariable); 195 var ds = Content.Problem.ProblemData.Dataset; 196 var rows = Enumerable.Range(Content.SamplesStart.Value, Content.SamplesEnd.Value - Content.SamplesStart.Value); 197 foreach (var variable in Content.Problem.ProblemData.Dataset.DoubleVariables) { 198 if (Content.Problem.ProblemData.AllowedInputVariables.Contains(variable)) continue; 199 int distinctValues = ds.GetDoubleValues(variable, rows).Distinct().Count(); 200 if (distinctValues < 2 || distinctValues > 20) continue; 201 partitionVariableComboBox.Items.Add(variable); 202 } 203 partitionVariableComboBox.SelectedItem = Content.PartitionVariable; 204 partitionVariableComboBox.EndUpdate(); 205 disableUpdateToContent = false; 206 } 207 } 208 165 209 private void Content_NumberOfWorker_ValueChanged(object sender, EventArgs e) { 166 210 workersNumericUpDown.Value = Content.NumberOfWorkers.Value; … … 202 246 } 203 247 private void foldsNumericUpDown_ValueChanged(object sender, EventArgs e) { 204 if (Content != null) 205 Content.Folds.Value = (int)foldsNumericUpDown.Value; 248 if (Content != null && !disableUpdateToContent) { 249 Content.Folds = (int)foldsNumericUpDown.Value; 250 } 206 251 } 207 252 … … 238 283 try { 239 284 Content.Algorithm = (IAlgorithm)algorithmTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType(); 240 } 241 catch (Exception ex) { 285 } catch (Exception ex) { 242 286 ErrorHandling.ShowErrorDialog(this, ex); 243 287 } … … 258 302 else 259 303 Content.Algorithm = algorithm; 260 } 261 catch (Exception ex) { 304 } catch (Exception ex) { 262 305 ErrorHandling.ShowErrorDialog(this, ex); 263 } 264 finally { 306 } finally { 265 307 Invoke(new Action(delegate() { 266 308 algorithmTabControl.Enabled = true; … … 298 340 else 299 341 Content.Problem = problem; 300 } 301 catch (Exception ex) { 342 } catch (Exception ex) { 302 343 Invoke(new Action(() => ErrorHandling.ShowErrorDialog(this, ex))); 303 } 304 finally { 344 } finally { 305 345 Invoke(new Action(delegate() { 306 346 algorithmProblemViewHost.Enabled = true; … … 358 398 #endregion 359 399 400 private void partitionVariableComboBox_SelectionChangeCommitted(object sender, EventArgs e) { 401 // when the user changes the selection in the GUI 402 if (Content != null && !disableUpdateToContent) 403 Content.PartitionVariable = (string)partitionVariableComboBox.SelectedItem; 404 } 360 405 } 361 406 } -
branches/crossvalidation-2434/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r12504 r12800 52 52 results = new ResultCollection(); 53 53 54 folds = new IntValue(2);54 folds = 2; 55 55 numberOfWorkers = new IntValue(1); 56 56 samplesStart = new IntValue(0); … … 73 73 RegisterEvents(); 74 74 if (Algorithm != null) RegisterAlgorithmEvents(); 75 76 // BackwardsCompatibility3.4 77 #region Backwards compatible code, remove with 3.6 78 if (persistenceCompatibilityFolds != null) folds = persistenceCompatibilityFolds.Value; 79 #endregion 75 80 } 76 81 … … 85 90 results = cloner.Clone(original.results); 86 91 87 folds = cloner.Clone(original.folds);92 folds = original.folds; 88 93 numberOfWorkers = cloner.Clone(original.numberOfWorkers); 89 94 samplesStart = cloner.Clone(original.samplesStart); … … 171 176 } 172 177 173 [Storable] 174 private IntValue folds; 175 public IntValue Folds { 178 // BackwardsCompatibility3.4 179 #region Backwards compatible code, remove with 3.6 180 [Storable(Name = "folds")] 181 private IntValue persistenceCompatibilityFolds; 182 #endregion 183 184 [Storable(Name = "foldsNew")] 185 private int folds; 186 public int Folds { 176 187 get { return folds; } 177 } 188 set { 189 if (value != folds) { 190 folds = value; 191 partitionVariable = NoPartitionVariable; // setting folds updates the partition variable 192 OnFoldsChanged(); 193 } 194 } 195 } 196 197 [Storable] 198 // folds are either specified explicitly or by a varaible from the dataset 199 public const string NoPartitionVariable = "<none>"; 200 private string partitionVariable = NoPartitionVariable; 201 public string PartitionVariable { 202 get { return partitionVariable; } 203 set { 204 if (value != partitionVariable) { 205 partitionVariable = value; 206 UpdateNumberOfFolds(); 207 } 208 } 209 } 210 178 211 [Storable] 179 212 private IntValue samplesStart; … … 244 277 } 245 278 } 279 246 280 #endregion 247 281 … … 273 307 //create cloned algorithms 274 308 if (clonedAlgorithms.Count == 0) { 275 int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / Folds.Value; 276 277 for (int i = 0; i < Folds.Value; i++) { 309 310 for (int i = 0; i < folds; i++) { 278 311 IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone(); 279 312 clonedAlgorithm.Name = algorithm.Name + " Fold " + i; … … 281 314 ISymbolicDataAnalysisProblem symbolicProblem = problem as ISymbolicDataAnalysisProblem; 282 315 283 int testStart = (i * testSamplesCount) + SamplesStart.Value; 284 int testEnd = (i + 1) == Folds.Value ? SamplesEnd.Value : (i + 1) * testSamplesCount + SamplesStart.Value; 316 int trainingStart, trainingEnd, testStart, testEnd; 317 // assumes that partitions are subset of subsequent rows 318 GetTrainingAndTestPartitions(i, out trainingStart, out trainingEnd, out testStart, out testEnd); 285 319 286 320 problem.ProblemData.TrainingPartition.Start = SamplesStart.Value; … … 306 340 int startedAlgorithms = 0; 307 341 foreach (IAlgorithm clonedAlgorithm in clonedAlgorithms) { 308 if (startedAlgorithms < NumberOfWorkers.Value) {342 if (startedAlgorithms < numberOfWorkers.Value) { 309 343 if (clonedAlgorithm.ExecutionState == ExecutionState.Prepared || 310 344 clonedAlgorithm.ExecutionState == ExecutionState.Paused) { … … 324 358 } 325 359 OnStarted(); 360 } 361 } 362 363 private void GetTrainingAndTestPartitions(int fold, out int trainingStart, out int trainingEnd, out int testStart, out int testEnd) { 364 if (partitionVariable == NoPartitionVariable) { 365 // uniform split 366 int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / folds; 367 trainingStart = SamplesStart.Value; 368 trainingEnd = SamplesEnd.Value; 369 testStart = (fold * testSamplesCount) + SamplesStart.Value; 370 testEnd = (fold + 1) == folds ? SamplesEnd.Value : (fold + 1) * testSamplesCount + SamplesStart.Value; 371 } else { 372 // group rowIdx by partition 373 var partition = Problem.ProblemData.Dataset.GetReadOnlyDoubleValues(partitionVariable); 374 var g = Enumerable.Range(SamplesStart.Value, SamplesEnd.Value - SamplesStart.Value).GroupBy(r => partition[r]).OrderBy(r => r.Key).ToList(); 375 trainingStart = SamplesStart.Value; 376 trainingEnd = SamplesEnd.Value; 377 testStart = g[fold].Min(); 378 testEnd = g[fold].Max() + 1; 326 379 } 327 380 } … … 365 418 values.Add("Algorithm Name", new StringValue(Name)); 366 419 values.Add("Algorithm Type", new StringValue(GetType().GetPrettyName())); 367 values.Add("Folds", new IntValue( Folds.Value));420 values.Add("Folds", new IntValue(folds)); 368 421 369 422 if (algorithm != null) { … … 516 569 #region events 517 570 private void RegisterEvents() { 518 Folds.ValueChanged += new EventHandler(Folds_ValueChanged); 571 SamplesStart.ValueChanged += (s, e) => UpdateNumberOfFolds(); 572 SamplesEnd.ValueChanged += (s, e) => UpdateNumberOfFolds(); 573 519 574 RegisterClonedAlgorithmsEvents(); 520 575 } 521 private void Folds_ValueChanged(object sender, EventArgs e) { 522 if (ExecutionState != ExecutionState.Prepared) 523 throw new InvalidOperationException("Can not change number of folds if the execution state is not prepared."); 576 577 private void UpdateNumberOfFolds() { 578 if (ExecutionState == ExecutionState.Paused || executionState == ExecutionState.Started) 579 throw new InvalidOperationException("Can not change number of folds if crossvalidation is paused or started."); 580 581 if (partitionVariable != NoPartitionVariable) { 582 // number of folds is the number of distinct values of the partition variable in the range [SamplesStart..SamplesEnd[ 583 var ds = Problem.ProblemData.Dataset; 584 var partitionValues = ds.GetDoubleValues(PartitionVariable, Enumerable.Range(SamplesStart.Value, SamplesEnd.Value - SamplesStart.Value)).Distinct().Count(); 585 folds = partitionValues; 586 OnFoldsChanged(); 587 } 524 588 } 525 589 … … 555 619 public event EventHandler ProblemChanged; 556 620 private void OnProblemChanged() { 621 ConfigureProblem(); 557 622 EventHandler handler = ProblemChanged; 558 623 if (handler != null) handler(this, EventArgs.Empty); 559 ConfigureProblem();560 624 } 561 625 … … 565 629 566 630 private void ConfigureProblem() { 631 folds = 2; 632 partitionVariable = NoPartitionVariable; 567 633 SamplesStart.Value = 0; 568 634 if (Problem != null) { … … 687 753 688 754 #region event firing 755 756 public event EventHandler FoldsChanged; 757 private void OnFoldsChanged() { 758 EventHandler handler = FoldsChanged; 759 if (handler != null) handler(this, EventArgs.Empty); 760 } 689 761 public event EventHandler ExecutionStateChanged; 690 762 private void OnExecutionStateChanged() {
Note: See TracChangeset
for help on using the changeset viewer.