Changeset 495
- Timestamp:
- 08/11/08 14:40:39 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/StructIdProblemInjectorView.cs
r488 r495 39 39 } 40 40 41 public StructIdProblemInjectorView() : base() { 41 public StructIdProblemInjectorView() 42 : base() { 42 43 InitializeComponent(); 43 44 } … … 62 63 protected override void UpdateControls() { 63 64 base.UpdateControls(); 64 if 65 if(StructIdProblemInjector == null) { 65 66 importInstanceButton.Enabled = false; 66 67 } else { … … 72 73 73 74 private void importInstanceButton_Click(object sender, EventArgs e) { 74 if 75 if(openFileDialog.ShowDialog(this) == DialogResult.OK) { 75 76 DatasetParser parser = new DatasetParser(); 76 77 bool success = false; … … 90 91 ShowErrorMessageBox(ex); 91 92 } 92 if 93 if(success) { 93 94 Dataset dataset = (Dataset)StructIdProblemInjector.GetVariable("Dataset").Value; 94 95 dataset.Rows = parser.Rows; … … 98 99 dataset.Samples = new double[dataset.Rows * dataset.Columns]; 99 100 Array.Copy(parser.Samples, dataset.Samples, dataset.Columns * dataset.Rows); 100 ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesStart").Value).Data = parser.TrainingSamplesStart; 101 ((IntData)StructIdProblemInjector.GetVariable("TrainingSamplesEnd").Value).Data = parser.TrainingSamplesEnd; 102 ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesStart").Value).Data = parser.ValidationSamplesStart; 103 ((IntData)StructIdProblemInjector.GetVariable("ValidationSamplesEnd").Value).Data = parser.ValidationSamplesEnd; 104 ((IntData)StructIdProblemInjector.GetVariable("TestSamplesStart").Value).Data = parser.TestSamplesStart; 105 ((IntData)StructIdProblemInjector.GetVariable("TestSamplesEnd").Value).Data = parser.TestSamplesEnd; 106 ((IntData)StructIdProblemInjector.GetVariable("TargetVariable").Value).Data = parser.TargetVariable; 107 ItemList<IntData> allowedFeatures = (ItemList<IntData>)StructIdProblemInjector.GetVariable("AllowedFeatures").Value; 108 allowedFeatures.Clear(); 109 List<int> nonInputVariables = parser.NonInputVariables; 110 for(int i = 0; i < dataset.Columns; i++) { 111 if(!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i)); 101 TrySetVariable("TrainingSamplesStart", parser.TrainingSamplesStart); 102 TrySetVariable("TrainingSamplesStart", parser.TrainingSamplesStart); 103 TrySetVariable("TrainingSamplesEnd", parser.TrainingSamplesEnd); 104 TrySetVariable("ValidationSamplesStart", parser.ValidationSamplesStart); 105 TrySetVariable("ValidationSamplesEnd", parser.ValidationSamplesEnd); 106 TrySetVariable("TestSamplesStart", parser.TestSamplesStart); 107 TrySetVariable("TestSamplesEnd", parser.TestSamplesEnd); 108 TrySetVariable("TargetVariable", parser.TargetVariable); 109 110 IVariable var = StructIdProblemInjector.GetVariable("AllowedFeatures"); 111 if(var != null) { 112 ItemList<IntData> allowedFeatures = (ItemList<IntData>)var.Value; 113 allowedFeatures.Clear(); 114 List<int> nonInputVariables = parser.NonInputVariables; 115 for(int i = 0; i < dataset.Columns; i++) { 116 if(!nonInputVariables.Contains(i)) allowedFeatures.Add(new IntData(i)); 117 } 112 118 } 113 119 Refresh(); 114 120 } 121 } 122 } 123 124 private void TrySetVariable(string name, int value) { 125 IVariable var = StructIdProblemInjector.GetVariable(name); 126 if(var != null) { 127 ((IntData)var.Value).Data = value; 115 128 } 116 129 }
Note: See TracChangeset
for help on using the changeset viewer.