- Timestamp:
- 11/08/12 16:43:08 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 5 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationImportTypeDialog.Designer.cs ¶
r8877 r8885 1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 2 23 partial class ClassificationImportTypeDialog { 3 24 /// <summary> … … 24 45 /// </summary> 25 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ClassificationImportTypeDialog)); 26 48 this.TargetVariableComboBox = new System.Windows.Forms.ComboBox(); 27 49 this.TargetVariableLabel = new System.Windows.Forms.Label(); 28 50 this.TargetVariableInfoLabel = new System.Windows.Forms.Label(); 51 this.UniformDistributionOfClassesCheckbox = new System.Windows.Forms.CheckBox(); 52 this.UniformDistributClassValuesInfoLabel = new System.Windows.Forms.Label(); 29 53 ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).BeginInit(); 30 54 this.CSVSettingsGroupBox.SuspendLayout(); … … 32 56 this.SuspendLayout(); 33 57 // 58 // ShuffleDataCheckbox 59 // 60 this.ShuffleDataCheckbox.CheckedChanged += new System.EventHandler(this.ShuffleDataCheckbox_CheckedChanged); 61 // 62 // OkButton 63 // 64 this.OkButton.Location = new System.Drawing.Point(303, 464); 65 // 66 // TrainingTestTrackBar 67 // 68 this.TrainingTestTrackBar.Location = new System.Drawing.Point(6, 70); 69 // 70 // TestLabel 71 // 72 this.TestLabel.Location = new System.Drawing.Point(303, 95); 73 // 74 // TrainingLabel 75 // 76 this.TrainingLabel.Location = new System.Drawing.Point(76, 95); 77 // 78 // CancelationButton 79 // 80 this.CancelationButton.Location = new System.Drawing.Point(384, 464); 81 // 34 82 // ProblemDataSettingsGroupBox 35 83 // 84 this.ProblemDataSettingsGroupBox.Controls.Add(this.UniformDistributClassValuesInfoLabel); 36 85 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableInfoLabel); 37 86 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableLabel); 38 87 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox); 39 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewLabel, 0); 40 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffelInfoLabel, 0); 88 this.ProblemDataSettingsGroupBox.Controls.Add(this.UniformDistributionOfClassesCheckbox); 89 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 315); 90 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.UniformDistributionOfClassesCheckbox, 0); 41 91 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableComboBox, 0); 42 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffleDataCheckbox, 0);43 92 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableLabel, 0); 44 93 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableInfoLabel, 0); 94 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.UniformDistributClassValuesInfoLabel, 0); 95 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewLabel, 0); 45 96 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TrainingTestTrackBar, 0); 46 97 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TrainingLabel, 0); 98 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TestLabel, 0); 99 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffelInfoLabel, 0); 100 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffleDataCheckbox, 0); 47 101 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewDatasetMatrix, 0); 48 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TestLabel, 0);49 102 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ErrorTextBox, 0); 50 103 // 104 // ErrorTextBox 105 // 106 this.ErrorTextBox.Location = new System.Drawing.Point(6, 19); 107 this.ErrorTextBox.Size = new System.Drawing.Size(435, 96); 108 // 109 // PreviewDatasetMatrix 110 // 111 this.PreviewDatasetMatrix.Location = new System.Drawing.Point(6, 134); 112 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 175); 113 // 114 // PreviewLabel 115 // 116 this.PreviewLabel.Location = new System.Drawing.Point(6, 118); 117 // 51 118 // TargetVariableComboBox 52 119 // 53 120 this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 54 121 | System.Windows.Forms.AnchorStyles.Right))); 55 122 this.TargetVariableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 56 123 this.TargetVariableComboBox.FormattingEnabled = true; 57 this.TargetVariableComboBox.Location = new System.Drawing.Point( 230, 19);124 this.TargetVariableComboBox.Location = new System.Drawing.Point(94, 43); 58 125 this.TargetVariableComboBox.Name = "TargetVariableComboBox"; 59 this.TargetVariableComboBox.Size = new System.Drawing.Size( 181, 21);126 this.TargetVariableComboBox.Size = new System.Drawing.Size(317, 21); 60 127 this.TargetVariableComboBox.TabIndex = 10; 61 128 // … … 63 130 // 64 131 this.TargetVariableLabel.AutoSize = true; 65 this.TargetVariableLabel.Location = new System.Drawing.Point( 142, 22);132 this.TargetVariableLabel.Location = new System.Drawing.Point(6, 46); 66 133 this.TargetVariableLabel.Name = "TargetVariableLabel"; 67 134 this.TargetVariableLabel.Size = new System.Drawing.Size(82, 13); … … 69 136 this.TargetVariableLabel.Text = "Target Variable:"; 70 137 // 71 // TargetVariableinfoLabel 72 // 73 this.TargetVariableInfoLabel.Location = new System.Drawing.Point(421, 21); 74 this.TargetVariableInfoLabel.Name = "Target Variable Info"; 138 // TargetVariableInfoLabel 139 // 140 this.TargetVariableInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 141 this.TargetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 142 this.TargetVariableInfoLabel.Location = new System.Drawing.Point(421, 45); 143 this.TargetVariableInfoLabel.Name = "TargetVariableInfoLabel"; 75 144 this.TargetVariableInfoLabel.Size = new System.Drawing.Size(16, 16); 76 145 this.TargetVariableInfoLabel.TabIndex = 21; 77 146 this.TargetVariableInfoLabel.Tag = "Select the target variable of the csv file."; 78 this.T argetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;147 this.ToolTip.SetToolTip(this.TargetVariableInfoLabel, (string)this.TargetVariableInfoLabel.Tag); 79 148 this.TargetVariableInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 149 // 150 // UniformDistributionOfClassesCheckbox 151 // 152 this.UniformDistributionOfClassesCheckbox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 153 this.UniformDistributionOfClassesCheckbox.AutoSize = true; 154 this.UniformDistributionOfClassesCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; 155 this.UniformDistributionOfClassesCheckbox.Enabled = false; 156 this.UniformDistributionOfClassesCheckbox.Location = new System.Drawing.Point(259, 19); 157 this.UniformDistributionOfClassesCheckbox.Name = "UniformDistributionOfClassesCheckbox"; 158 this.UniformDistributionOfClassesCheckbox.Size = new System.Drawing.Size(152, 17); 159 this.UniformDistributionOfClassesCheckbox.TabIndex = 22; 160 this.UniformDistributionOfClassesCheckbox.Text = "Uniformly distribute classes"; 161 this.UniformDistributionOfClassesCheckbox.UseVisualStyleBackColor = true; 162 // 163 // UniformDistributClassValuesInfoLabel 164 // 165 this.UniformDistributClassValuesInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 166 this.UniformDistributClassValuesInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 167 this.UniformDistributClassValuesInfoLabel.Location = new System.Drawing.Point(421, 20); 168 this.UniformDistributClassValuesInfoLabel.Name = "UniformDistributClassValuesInfoLabel"; 169 this.UniformDistributClassValuesInfoLabel.Size = new System.Drawing.Size(16, 16); 170 this.UniformDistributClassValuesInfoLabel.TabIndex = 23; 171 this.UniformDistributClassValuesInfoLabel.Tag = "Check, if classes should be distributed uniformly between training and test. This" + 172 " can change the distribution of training and test a little bit."; 173 this.ToolTip.SetToolTip(this.UniformDistributClassValuesInfoLabel, (string)this.UniformDistributClassValuesInfoLabel.Tag); 174 this.UniformDistributClassValuesInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 80 175 // 81 176 // ClassificationImportTypeDialog … … 83 178 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 84 179 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 85 this.ClientSize = new System.Drawing.Size(471, 4 42);180 this.ClientSize = new System.Drawing.Size(471, 499); 86 181 this.Name = "ClassificationImportTypeDialog"; 87 182 this.Text = "Classification CSV Import"; … … 95 190 96 191 } 97 98 192 #endregion 99 193 100 pr ivateSystem.Windows.Forms.ComboBox TargetVariableComboBox;101 pr ivateSystem.Windows.Forms.Label TargetVariableLabel;194 protected System.Windows.Forms.ComboBox TargetVariableComboBox; 195 protected System.Windows.Forms.Label TargetVariableLabel; 102 196 protected System.Windows.Forms.Label TargetVariableInfoLabel; 103 104 197 protected System.Windows.Forms.Label UniformDistributClassValuesInfoLabel; 198 protected System.Windows.Forms.CheckBox UniformDistributionOfClassesCheckbox; 105 199 } 106 200 } -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationImportTypeDialog.cs ¶
r8877 r8885 33 33 Shuffle = ShuffleDataCheckbox.Checked, 34 34 Training = TrainingTestTrackBar.Value, 35 TargetVariable = (String)TargetVariableComboBox.SelectedValue 35 TargetVariable = (String)TargetVariableComboBox.SelectedValue, 36 UniformlyDistributeClasses = UniformDistributionOfClassesCheckbox.Checked 36 37 }; 37 38 } … … 40 41 public ClassificationImportTypeDialog() { 41 42 InitializeComponent(); 42 43 ToolTip.SetToolTip(TargetVariableInfoLabel, (string)TargetVariableInfoLabel.Tag);44 43 } 45 44 … … 58 57 } 59 58 } 59 60 private void ShuffleDataCheckbox_CheckedChanged(object sender, System.EventArgs e) { 61 UniformDistributionOfClassesCheckbox.Enabled = ShuffleDataCheckbox.Checked; 62 } 60 63 } 61 64 } -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationInstanceConsumerView.Designer.cs ¶
r8877 r8885 1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 2 23 partial class ClassificationInstanceConsumerView { 3 24 /// <summary> -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationInstanceConsumerView.cs ¶
r8877 r8885 48 48 instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat); 49 49 } 50 catch ( Exception ex) {51 MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);50 catch (IOException ex) { 51 ErrorWhileParsing(ex); 52 52 return; 53 53 } … … 55 55 GenericConsumer.Load(instance); 56 56 } 57 catch ( Exception ex) {58 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");57 catch (IOException ex) { 58 ErrorWhileLoading(ex, importTypeDialog.Path); 59 59 } 60 60 } else { -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.Designer.cs ¶
r8877 r8885 1 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 2 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 3 23 partial class DataAnalysisImportTypeDialog { … … 26 46 private void InitializeComponent() { 27 47 this.components = new System.ComponentModel.Container(); 28 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DataAnalysisImportTypeDialog));29 48 this.ShuffleDataCheckbox = new System.Windows.Forms.CheckBox(); 30 49 this.OkButton = new System.Windows.Forms.Button(); … … 32 51 this.TestLabel = new System.Windows.Forms.Label(); 33 52 this.TrainingLabel = new System.Windows.Forms.Label(); 34 this.Cancel Button = new System.Windows.Forms.Button();53 this.CancelationButton = new System.Windows.Forms.Button(); 35 54 this.OpenFileButton = new System.Windows.Forms.Button(); 36 55 this.ProblemFileLabel = new System.Windows.Forms.Label(); … … 74 93 this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; 75 94 this.OkButton.Enabled = false; 76 this.OkButton.Location = new System.Drawing.Point( 87, 407);95 this.OkButton.Location = new System.Drawing.Point(303, 407); 77 96 this.OkButton.Name = "OkButton"; 78 97 this.OkButton.Size = new System.Drawing.Size(75, 23); … … 84 103 // 85 104 this.TrainingTestTrackBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 86 105 | System.Windows.Forms.AnchorStyles.Right))); 87 106 this.TrainingTestTrackBar.Location = new System.Drawing.Point(6, 43); 88 107 this.TrainingTestTrackBar.Maximum = 100; … … 114 133 this.TrainingLabel.Text = "Training: 66 %"; 115 134 // 116 // Cancel Button117 // 118 this.Cancel Button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));119 this.Cancel Button.DialogResult = System.Windows.Forms.DialogResult.Cancel;120 this.Cancel Button.Location = new System.Drawing.Point(318, 407);121 this.Cancel Button.Name = "CancelButton";122 this.Cancel Button.Size = new System.Drawing.Size(75, 23);123 this.Cancel Button.TabIndex = 3;124 this.Cancel Button.Text = "&Cancel";125 this.Cancel Button.UseVisualStyleBackColor = true;135 // CancelationButton 136 // 137 this.CancelationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 138 this.CancelationButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 139 this.CancelationButton.Location = new System.Drawing.Point(384, 407); 140 this.CancelationButton.Name = "CancelationButton"; 141 this.CancelationButton.Size = new System.Drawing.Size(75, 23); 142 this.CancelationButton.TabIndex = 3; 143 this.CancelationButton.Text = "&Cancel"; 144 this.CancelationButton.UseVisualStyleBackColor = true; 126 145 // 127 146 // OpenFileButton … … 148 167 // 149 168 this.ProblemTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 150 169 | System.Windows.Forms.AnchorStyles.Right))); 151 170 this.ProblemTextBox.Location = new System.Drawing.Point(91, 6); 152 171 this.ProblemTextBox.Name = "ProblemTextBox"; … … 162 181 // 163 182 this.DateTimeFormatComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 164 183 | System.Windows.Forms.AnchorStyles.Right))); 165 184 this.DateTimeFormatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 166 185 this.DateTimeFormatComboBox.FormattingEnabled = true; … … 174 193 // 175 194 this.DecimalSeparatorComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 176 195 | System.Windows.Forms.AnchorStyles.Right))); 177 196 this.DecimalSeparatorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 178 197 this.DecimalSeparatorComboBox.FormattingEnabled = true; … … 213 232 // 214 233 this.SeparatorComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 215 234 | System.Windows.Forms.AnchorStyles.Right))); 216 235 this.SeparatorComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 217 236 this.SeparatorComboBox.FormattingEnabled = true; … … 225 244 // 226 245 this.CSVSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 227 246 | System.Windows.Forms.AnchorStyles.Right))); 228 247 this.CSVSettingsGroupBox.Controls.Add(this.DateTimeFormatInfoLabel); 229 248 this.CSVSettingsGroupBox.Controls.Add(this.DecimalSeparatorInfoLabel); … … 245 264 // 246 265 this.DateTimeFormatInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 266 this.DateTimeFormatInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 247 267 this.DateTimeFormatInfoLabel.Location = new System.Drawing.Point(421, 76); 248 this.DateTimeFormatInfoLabel.Name = "DateTime Format Info";268 this.DateTimeFormatInfoLabel.Name = "DateTimeFormatInfoLabel"; 249 269 this.DateTimeFormatInfoLabel.Size = new System.Drawing.Size(16, 16); 250 270 this.DateTimeFormatInfoLabel.TabIndex = 23; 251 271 this.DateTimeFormatInfoLabel.Tag = "Select the date time format used in the csv file"; 252 this. DateTimeFormatInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;272 this.ToolTip.SetToolTip(this.DateTimeFormatInfoLabel, "Select the date time format used in the csv file"); 253 273 this.DateTimeFormatInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 254 274 // … … 256 276 // 257 277 this.DecimalSeparatorInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 278 this.DecimalSeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 258 279 this.DecimalSeparatorInfoLabel.Location = new System.Drawing.Point(421, 49); 259 this.DecimalSeparatorInfoLabel.Name = "Decimal Separator Info";280 this.DecimalSeparatorInfoLabel.Name = "DecimalSeparatorInfoLabel"; 260 281 this.DecimalSeparatorInfoLabel.Size = new System.Drawing.Size(16, 16); 261 282 this.DecimalSeparatorInfoLabel.TabIndex = 22; 262 283 this.DecimalSeparatorInfoLabel.Tag = "Select the decimal separator used to for double values"; 263 this. DecimalSeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;284 this.ToolTip.SetToolTip(this.DecimalSeparatorInfoLabel, "Select the decimal separator used to for double values"); 264 285 this.DecimalSeparatorInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 265 286 // … … 267 288 // 268 289 this.SeparatorInfoLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 290 this.SeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 269 291 this.SeparatorInfoLabel.Location = new System.Drawing.Point(421, 22); 270 this.SeparatorInfoLabel.Name = "Separator Info";292 this.SeparatorInfoLabel.Name = "SeparatorInfoLabel"; 271 293 this.SeparatorInfoLabel.Size = new System.Drawing.Size(16, 16); 272 294 this.SeparatorInfoLabel.TabIndex = 21; 273 295 this.SeparatorInfoLabel.Tag = "Select the separator used to separate columns in the csv file."; 274 this. SeparatorInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;296 this.ToolTip.SetToolTip(this.SeparatorInfoLabel, "Select the separator used to separate columns in the csv file."); 275 297 this.SeparatorInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 276 298 // … … 278 300 // 279 301 this.ProblemDataSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 280 281 302 | System.Windows.Forms.AnchorStyles.Left) 303 | System.Windows.Forms.AnchorStyles.Right))); 282 304 this.ProblemDataSettingsGroupBox.Controls.Add(this.ErrorTextBox); 283 305 this.ProblemDataSettingsGroupBox.Controls.Add(this.ShuffelInfoLabel); … … 306 328 // ShuffelInfoLabel 307 329 // 330 this.ShuffelInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 308 331 this.ShuffelInfoLabel.Location = new System.Drawing.Point(111, 20); 309 this.ShuffelInfoLabel.Name = "Shuff le Info";332 this.ShuffelInfoLabel.Name = "ShuffelInfoLabel"; 310 333 this.ShuffelInfoLabel.Size = new System.Drawing.Size(16, 16); 311 334 this.ShuffelInfoLabel.TabIndex = 8; 312 335 this.ShuffelInfoLabel.Tag = "Check, if the importat data should be shuffled"; 313 this. ShuffelInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information;336 this.ToolTip.SetToolTip(this.ShuffelInfoLabel, "Check, if the importat data should be shuffled"); 314 337 this.ShuffelInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 315 338 // … … 326 349 // 327 350 this.PreviewDatasetMatrix.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 328 329 351 | System.Windows.Forms.AnchorStyles.Left) 352 | System.Windows.Forms.AnchorStyles.Right))); 330 353 this.PreviewDatasetMatrix.Caption = "Dataset Preview"; 331 354 this.PreviewDatasetMatrix.Content = null; … … 350 373 this.Controls.Add(this.OpenFileButton); 351 374 this.Controls.Add(this.ProblemFileLabel); 352 this.Controls.Add(this.Cancel Button);375 this.Controls.Add(this.CancelationButton); 353 376 this.Controls.Add(this.OkButton); 354 377 this.MaximizeBox = false; … … 375 398 protected System.Windows.Forms.Label TestLabel; 376 399 protected System.Windows.Forms.Label TrainingLabel; 377 protected System.Windows.Forms.Button Cancel Button;400 protected System.Windows.Forms.Button CancelationButton; 378 401 protected System.Windows.Forms.OpenFileDialog openFileDialog; 379 402 protected System.Windows.Forms.Label ProblemFileLabel; -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.cs ¶
r8877 r8885 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.ComponentModel;25 24 using System.Globalization; 26 25 using System.Linq; … … 32 31 public partial class DataAnalysisImportTypeDialog : Form { 33 32 34 public static readonly BindingList<KeyValuePair<DateTimeFormatInfo, string>> dateTimeFormats = new BindingList<KeyValuePair<DateTimeFormatInfo, string>>{33 public static readonly List<KeyValuePair<DateTimeFormatInfo, string>> dateTimeFormats = new List<KeyValuePair<DateTimeFormatInfo, string>>{ 35 34 new KeyValuePair<DateTimeFormatInfo, string>(DateTimeFormatInfo.GetInstance(new CultureInfo("de-DE")), "dd/mm/yyyy hh:MM:ss" ), 36 35 new KeyValuePair<DateTimeFormatInfo, string>(DateTimeFormatInfo.InvariantInfo, "mm/dd/yyyy hh:MM:ss" ), … … 39 38 }; 40 39 41 public static readonly BindingList<KeyValuePair<char, string>> POSSIBLE_SEPARATORS = new BindingList<KeyValuePair<char, string>>{40 public static readonly List<KeyValuePair<char, string>> POSSIBLE_SEPARATORS = new List<KeyValuePair<char, string>>{ 42 41 new KeyValuePair<char, string>(',', ", (Comma)" ), 43 42 new KeyValuePair<char, string>(';', "; (Semicolon)" ), … … 45 44 }; 46 45 47 public static readonly BindingList<KeyValuePair<NumberFormatInfo, string>> POSSIBLE_DECIMAL_SEPARATORS = new BindingList<KeyValuePair<NumberFormatInfo, string>>{46 public static readonly List<KeyValuePair<NumberFormatInfo, string>> POSSIBLE_DECIMAL_SEPARATORS = new List<KeyValuePair<NumberFormatInfo, string>>{ 48 47 new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.InvariantInfo, ". (Period)" ), 49 48 new KeyValuePair<NumberFormatInfo, string>(NumberFormatInfo.GetInstance(new CultureInfo("de-DE")), ", (Comma)" ) … … 75 74 public DataAnalysisImportTypeDialog() { 76 75 InitializeComponent(); 77 ToolTip.SetToolTip(SeparatorInfoLabel, (string)SeparatorInfoLabel.Tag);78 ToolTip.SetToolTip(DecimalSeparatorInfoLabel, (string)DecimalSeparatorInfoLabel.Tag);79 ToolTip.SetToolTip(DateTimeFormatInfoLabel, (string)DateTimeFormatInfoLabel.Tag);80 ToolTip.SetToolTip(ShuffelInfoLabel, (string)ShuffelInfoLabel.Tag);81 76 82 77 SeparatorComboBox.DataSource = POSSIBLE_SEPARATORS; -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceConsumerView.Designer.cs ¶
r8598 r8885 1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 2 23 partial class DataAnalysisInstanceConsumerView<T> { 3 24 /// <summary> -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisInstanceConsumerView.cs ¶
r8877 r8885 40 40 public DataAnalysisInstanceConsumerView() { 41 41 InitializeComponent(); 42 43 42 } 44 43 … … 51 50 try { 52 51 instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat); 53 54 52 } 55 catch ( Exception ex) {56 MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);53 catch (IOException ex) { 54 ErrorWhileParsing(ex); 57 55 return; 58 56 } … … 60 58 GenericConsumer.Load(instance); 61 59 } 62 catch ( Exception ex) {63 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");60 catch (IOException ex) { 61 ErrorWhileLoading(ex, importTypeDialog.Path); 64 62 } 65 63 } else { … … 70 68 } 71 69 } 70 71 protected void ErrorWhileParsing(Exception ex) { 72 MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error); 73 } 74 protected void ErrorWhileLoading(Exception ex, string path) { 75 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(path), Environment.NewLine + ex.Message), "Cannot load instance"); 76 } 72 77 } 73 78 } -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj ¶
r8877 r8885 70 70 </PropertyGroup> 71 71 <ItemGroup> 72 <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 73 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 74 <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 75 <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 72 76 <Reference Include="System" /> 73 77 <Reference Include="System.Core" /> 74 78 <Reference Include="System.Drawing" /> 75 79 <Reference Include="System.Windows.Forms" /> 80 <Reference Include="System.Windows.Forms.DataVisualization" /> 76 81 <Reference Include="System.Xml.Linq" /> 77 82 <Reference Include="System.Data.DataSetExtensions" /> … … 92 97 <Compile Include="ClassificationInstanceConsumerView.Designer.cs"> 93 98 <DependentUpon>ClassificationInstanceConsumerView.cs</DependentUpon> 99 </Compile> 100 <Compile Include="TimeSeriesPrognosisImportTypeDialog.cs"> 101 <SubType>Form</SubType> 102 </Compile> 103 <Compile Include="TimeSeriesPrognosisImportTypeDialog.Designer.cs"> 104 <DependentUpon>TimeSeriesPrognosisImportTypeDialog.cs</DependentUpon> 105 </Compile> 106 <Compile Include="TimeSeriesPrognosisInstanceConsumerView.cs"> 107 <SubType>UserControl</SubType> 108 </Compile> 109 <Compile Include="TimeSeriesPrognosisInstanceConsumerView.Designer.cs"> 110 <DependentUpon>TimeSeriesPrognosisInstanceConsumerView.cs</DependentUpon> 94 111 </Compile> 95 112 <Compile Include="DataAnalysisImportTypeDialog.cs"> … … 155 172 <Project>{3BD61258-31DA-4B09-89C0-4F71FEF5F05A}</Project> 156 173 <Name>HeuristicLab.MainForm-3.3</Name> 174 </ProjectReference> 175 <ProjectReference Include="..\..\HeuristicLab.Optimization.Views\3.3\HeuristicLab.Optimization.Views-3.3.csproj"> 176 <Project>{662B4B15-8F4D-4AE5-B3EB-D91C215F5AF2}</Project> 177 <Name>HeuristicLab.Optimization.Views-3.3</Name> 157 178 </ProjectReference> 158 179 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionImportTypeDialog.Designer.cs ¶
r8877 r8885 1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 2 23 partial class RegressionImportTypeDialog { 3 24 /// <summary> … … 79 100 this.TargetVariableInfoLabel.Image = HeuristicLab.Common.Resources.VSImageLibrary.Information; 80 101 this.TargetVariableInfoLabel.DoubleClick += new System.EventHandler(this.ControlToolTip_DoubleClick); 102 this.ToolTip.SetToolTip(this.TargetVariableInfoLabel, (string)this.TargetVariableInfoLabel.Tag); 81 103 // 82 104 // RegressionImportTypeDialog … … 86 108 this.ClientSize = new System.Drawing.Size(471, 442); 87 109 this.Name = "RegressionImportTypeDialog"; 88 this.Text = " Classification CSV Import";110 this.Text = "Regression CSV Import"; 89 111 ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).EndInit(); 90 112 this.CSVSettingsGroupBox.ResumeLayout(false); … … 99 121 #endregion 100 122 101 pr ivateSystem.Windows.Forms.ComboBox TargetVariableComboBox;102 pr ivateSystem.Windows.Forms.Label TargetVariableLabel;123 protected System.Windows.Forms.ComboBox TargetVariableComboBox; 124 protected System.Windows.Forms.Label TargetVariableLabel; 103 125 protected System.Windows.Forms.Label TargetVariableInfoLabel; 104 126 -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionImportTypeDialog.cs ¶
r8877 r8885 25 25 26 26 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 27 28 27 public partial class RegressionImportTypeDialog : DataAnalysisImportTypeDialog { 29 28 public new RegressionImportType ImportType { … … 39 38 public RegressionImportTypeDialog() { 40 39 InitializeComponent(); 41 42 ToolTip.SetToolTip(TargetVariableInfoLabel, (string)TargetVariableInfoLabel.Tag);43 40 } 44 41 -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceConsumerView.Designer.cs ¶
r8877 r8885 1 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 namespace HeuristicLab.Problems.Instances.DataAnalysis.Views { 2 23 partial class RegressionInstanceConsumerView { 3 24 /// <summary> -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceConsumerView.cs ¶
r8877 r8885 48 48 instance = provider.ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.CSVFormat); 49 49 } 50 catch ( Exception ex) {51 MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);50 catch (IOException ex) { 51 ErrorWhileParsing(ex); 52 52 return; 53 53 } … … 55 55 GenericConsumer.Load(instance); 56 56 } 57 catch ( Exception ex) {58 MessageBox.Show(String.Format("This problem does not support loading the instance {0}: {1}", Path.GetFileName(importTypeDialog.Path), Environment.NewLine + ex.Message), "Cannot load instance");57 catch (IOException ex) { 58 ErrorWhileLoading(ex, importTypeDialog.Path); 59 59 } 60 60 } else { -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs ¶
r8877 r8885 94 94 List<IList> values = csvFileParser.Values; 95 95 if (type.Shuffle) { 96 values = Shuffle(values, csvFileParser.VariableNames.ToList().FindIndex(x => x.Equals(type.TargetVariable)), 97 type.Training, out trainingPartEnd); 96 values = Shuffle(values); 97 if (type.UniformlyDistributeClasses) { 98 values = Shuffle(values, csvFileParser.VariableNames.ToList().FindIndex(x => x.Equals(type.TargetVariable)), 99 type.Training, out trainingPartEnd); 100 } 98 101 } 99 102 … … 147 150 trainingPartEnd = training.First().Count; 148 151 149 training = Shuffle(training);150 test = Shuffle(test);151 152 for (int i = 0; i < training.Count; i++) { 152 153 for (int j = 0; j < test[i].Count; j++) { -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ClassificationImportType.cs ¶
r8877 r8885 23 23 public class ClassificationImportType : DataAnalysisImportType { 24 24 public string TargetVariable { get; set; } 25 public bool UniformlyDistributeClasses { get; set; } 25 26 } 26 27 } -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj ¶
r8877 r8885 203 203 <Compile Include="TableFileParser.cs" /> 204 204 <Compile Include="TimeSeries\CSV\TimeSeriesPrognosisCSVInstanceProvider.cs" /> 205 <Compile Include="TimeSeries\TimeSeriesPrognosisImportType.cs" /> 205 206 <Compile Include="TimeSeries\TimeSeriesPrognosisInstanceProvider.cs" /> 206 207 </ItemGroup> -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs ¶
r8564 r8885 83 83 DateTimeFormatInfo dateTimeFormatInfo; 84 84 char separator; 85 DetermineFileFormat(new FileStream(fileName, FileMode.Open ), out numberFormat, out dateTimeFormatInfo, out separator);86 Parse(new FileStream(fileName, FileMode.Open ), numberFormat, dateTimeFormatInfo, separator);85 DetermineFileFormat(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), out numberFormat, out dateTimeFormatInfo, out separator); 86 Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator); 87 87 } 88 88 … … 95 95 /// <param name="separator">defines the separator</param> 96 96 public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) { 97 Parse(new FileStream(fileName, FileMode.Open ), numberFormat, dateTimeFormatInfo, separator);97 Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator); 98 98 } 99 99 … … 163 163 164 164 public static void DetermineFileFormat(string path, out NumberFormatInfo numberFormat, out DateTimeFormatInfo dateTimeFormatInfo, out char separator) { 165 DetermineFileFormat(new FileStream(path, FileMode.Open ), out numberFormat, out dateTimeFormatInfo, out separator);165 DetermineFileFormat(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), out numberFormat, out dateTimeFormatInfo, out separator); 166 166 } 167 167 -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/CSV/TimeSeriesPrognosisCSVInstanceProvider.cs ¶
r7890 r8885 20 20 #endregion 21 21 22 using System; 23 using System.Collections; 24 using System.Collections.Generic; 25 using System.IO; 26 using System.Linq; 27 using HeuristicLab.Common; 28 using HeuristicLab.Problems.DataAnalysis; 22 29 23 using System;24 using System.Collections.Generic;25 using HeuristicLab.Problems.DataAnalysis;26 30 namespace HeuristicLab.Problems.Instances.DataAnalysis { 27 31 public class TimeSeriesPrognosisCSVInstanceProvider : TimeSeriesPrognosisInstanceProvider { … … 48 52 throw new NotImplementedException(); 49 53 } 54 55 public override bool CanImportData { get { return true; } } 56 57 public override ITimeSeriesPrognosisProblemData ImportData(string path) { 58 TableFileParser csvFileParser = new TableFileParser(); 59 csvFileParser.Parse(path); 60 61 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 62 string targetVar = csvFileParser.VariableNames.Last(); 63 64 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar)); 65 66 ITimeSeriesPrognosisProblemData timeSeriesPrognosisData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar); 67 68 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 69 timeSeriesPrognosisData.TrainingPartition.Start = 0; 70 timeSeriesPrognosisData.TrainingPartition.End = trainingPartEnd; 71 timeSeriesPrognosisData.TestPartition.Start = trainingPartEnd; 72 timeSeriesPrognosisData.TestPartition.End = csvFileParser.Rows; 73 74 int pos = path.LastIndexOf('\\'); 75 if (pos < 0) 76 timeSeriesPrognosisData.Name = path; 77 else { 78 pos++; 79 timeSeriesPrognosisData.Name = path.Substring(pos, path.Length - pos); 80 } 81 return timeSeriesPrognosisData; 82 } 83 84 protected override ITimeSeriesPrognosisProblemData ImportData(string path, TimeSeriesPrognosisImportType type, TableFileParser csvFileParser) { 85 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 86 87 // turn of input variables that are constant in the training partition 88 var allowedInputVars = new List<string>(); 89 int trainingPartEnd = (csvFileParser.Rows * type.Training) / 100; 90 trainingPartEnd = trainingPartEnd > 0 ? trainingPartEnd : 1; 91 var trainingIndizes = Enumerable.Range(0, trainingPartEnd); 92 if (trainingIndizes.Count() >= 2) { 93 foreach (var variableName in dataset.DoubleVariables) { 94 if (dataset.GetDoubleValues(variableName, trainingIndizes).Range() > 0 && 95 variableName != type.TargetVariable) 96 allowedInputVars.Add(variableName); 97 } 98 } else { 99 allowedInputVars.AddRange(dataset.DoubleVariables.Where(x => !x.Equals(type.TargetVariable))); 100 } 101 102 TimeSeriesPrognosisProblemData timeSeriesPrognosisData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, type.TargetVariable); 103 104 timeSeriesPrognosisData.TrainingPartition.Start = 0; 105 timeSeriesPrognosisData.TrainingPartition.End = trainingPartEnd; 106 timeSeriesPrognosisData.TestPartition.Start = trainingPartEnd; 107 timeSeriesPrognosisData.TestPartition.End = csvFileParser.Rows; 108 109 timeSeriesPrognosisData.Name = Path.GetFileName(path); 110 111 return timeSeriesPrognosisData; 112 } 50 113 } 51 114 } -
TabularUnified trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/TimeSeriesPrognosisInstanceProvider.cs ¶
r8430 r8885 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Text;27 22 using HeuristicLab.Problems.DataAnalysis; 28 23 29 24 namespace HeuristicLab.Problems.Instances.DataAnalysis { 30 public abstract class TimeSeriesPrognosisInstanceProvider : IProblemInstanceProvider<ITimeSeriesPrognosisProblemData> { 31 public bool CanImportData { get { return true; } } 32 public bool CanExportData { get { return true; } } 33 34 35 public ITimeSeriesPrognosisProblemData ImportData(string path) { 36 TableFileParser csvFileParser = new TableFileParser(); 37 csvFileParser.Parse(path); 38 39 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); 40 string targetVar = csvFileParser.VariableNames.Last(); 41 42 IEnumerable<string> allowedInputVars = dataset.DoubleVariables.Where(x => !x.Equals(targetVar)); 43 44 ITimeSeriesPrognosisProblemData regData = new TimeSeriesPrognosisProblemData(dataset, allowedInputVars, targetVar); 45 46 int trainingPartEnd = csvFileParser.Rows * 2 / 3; 47 regData.TrainingPartition.Start = 0; 48 regData.TrainingPartition.End = trainingPartEnd; 49 regData.TestPartition.Start = trainingPartEnd; 50 regData.TestPartition.End = csvFileParser.Rows; 51 52 int pos = path.LastIndexOf('\\'); 53 if (pos < 0) 54 regData.Name = path; 55 else { 56 pos++; 57 regData.Name = path.Substring(pos, path.Length - pos); 58 } 59 return regData; 60 } 61 62 public void ExportData(ITimeSeriesPrognosisProblemData instance, string path) { 63 StringBuilder strBuilder = new StringBuilder(); 64 65 foreach (var variable in instance.InputVariables) { 66 strBuilder.Append(variable + ";"); 67 } 68 strBuilder.Remove(strBuilder.Length - 1, 1); 69 strBuilder.AppendLine(); 70 71 Dataset dataset = instance.Dataset; 72 73 for (int i = 0; i < dataset.Rows; i++) { 74 for (int j = 0; j < dataset.Columns; j++) { 75 strBuilder.Append(dataset.GetValue(i, j) + ";"); 76 } 77 strBuilder.Remove(strBuilder.Length - 1, 1); 78 strBuilder.AppendLine(); 79 } 80 81 using (StreamWriter writer = new StreamWriter(path)) { 82 writer.Write(strBuilder); 83 } 84 } 85 86 public abstract IEnumerable<IDataDescriptor> GetDataDescriptors(); 87 public abstract ITimeSeriesPrognosisProblemData LoadData(IDataDescriptor descriptor); 88 89 public abstract string Name { get; } 90 public abstract string Description { get; } 91 public abstract Uri WebLink { get; } 92 public abstract string ReferencePublication { get; } 25 public abstract class TimeSeriesPrognosisInstanceProvider : DataAnalysisInstanceProvider<ITimeSeriesPrognosisProblemData, TimeSeriesPrognosisImportType> { 93 26 } 94 27 }
Note: See TracChangeset
for help on using the changeset viewer.