- Timestamp:
- 04/09/14 13:08:49 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/HeuristicLab.DataPreprocessing.Views-3.3.csproj
r10717 r10737 243 243 </ProjectReference> 244 244 </ItemGroup> 245 <ItemGroup> 246 <EmbeddedResource Include="ManipulationView.resx"> 247 <DependentUpon>ManipulationView.cs</DependentUpon> 248 </EmbeddedResource> 249 </ItemGroup> 245 250 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 246 251 <PropertyGroup> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ManipulationView.Designer.cs
r10714 r10737 45 45 this.grpBoxPreview = new System.Windows.Forms.GroupBox(); 46 46 this.tabsPreview = new System.Windows.Forms.TabControl(); 47 this.tabPreviewInactive = new System.Windows.Forms.TabPage(); 47 48 this.tabPreviewDeleteColumnsInfo = new System.Windows.Forms.TabPage(); 49 this.lblPreviewColumnsInfo = new System.Windows.Forms.Label(); 48 50 this.tabPreviewDeleteColumnsVariance = new System.Windows.Forms.TabPage(); 51 this.label12 = new System.Windows.Forms.Label(); 52 this.lblPreviewColumnsVariance = new System.Windows.Forms.Label(); 49 53 this.tabPreviewDeleteRowsInfo = new System.Windows.Forms.TabPage(); 54 this.lblPreviewRowsInfo = new System.Windows.Forms.Label(); 50 55 this.tabPreviewShuffle = new System.Windows.Forms.TabPage(); 51 this.label9 = new System.Windows.Forms.Label(); 52 this.tabPreviewInactive = new System.Windows.Forms.TabPage(); 56 this.lblPreviewShuffle = new System.Windows.Forms.Label(); 53 57 this.grpBoxData.SuspendLayout(); 54 58 this.tabsData.SuspendLayout(); … … 60 64 this.grpBoxPreview.SuspendLayout(); 61 65 this.tabsPreview.SuspendLayout(); 66 this.tabPreviewDeleteColumnsInfo.SuspendLayout(); 67 this.tabPreviewDeleteColumnsVariance.SuspendLayout(); 68 this.tabPreviewDeleteRowsInfo.SuspendLayout(); 62 69 this.tabPreviewShuffle.SuspendLayout(); 63 70 this.SuspendLayout(); … … 194 201 // txtDeleteColumnsVariance 195 202 // 196 this.txtDeleteColumnsVariance.Location = new System.Drawing.Point(22 6, 0);203 this.txtDeleteColumnsVariance.Location = new System.Drawing.Point(229, 0); 197 204 this.txtDeleteColumnsVariance.Name = "txtDeleteColumnsVariance"; 198 205 this.txtDeleteColumnsVariance.Size = new System.Drawing.Size(135, 20); … … 205 212 this.label4.Location = new System.Drawing.Point(3, 3); 206 213 this.label4.Name = "label4"; 207 this.label4.Size = new System.Drawing.Size(2 17, 13);214 this.label4.Size = new System.Drawing.Size(220, 13); 208 215 this.label4.TabIndex = 3; 209 this.label4.Text = "Delete columns with a variance smaller than ";216 this.label4.Text = "Delete columns with a variance smaller than "; 210 217 // 211 218 // tabDataDeleteRowsInfo … … 298 305 this.tabsPreview.TabIndex = 3; 299 306 // 307 // tabPreviewInactive 308 // 309 this.tabPreviewInactive.Location = new System.Drawing.Point(4, 22); 310 this.tabPreviewInactive.Name = "tabPreviewInactive"; 311 this.tabPreviewInactive.Padding = new System.Windows.Forms.Padding(3); 312 this.tabPreviewInactive.Size = new System.Drawing.Size(711, 142); 313 this.tabPreviewInactive.TabIndex = 5; 314 this.tabPreviewInactive.Text = "inactive"; 315 this.tabPreviewInactive.UseVisualStyleBackColor = true; 316 // 300 317 // tabPreviewDeleteColumnsInfo 301 318 // 319 this.tabPreviewDeleteColumnsInfo.Controls.Add(this.lblPreviewColumnsInfo); 302 320 this.tabPreviewDeleteColumnsInfo.Location = new System.Drawing.Point(4, 22); 303 321 this.tabPreviewDeleteColumnsInfo.Name = "tabPreviewDeleteColumnsInfo"; … … 308 326 this.tabPreviewDeleteColumnsInfo.UseVisualStyleBackColor = true; 309 327 // 328 // lblPreviewColumnsInfo 329 // 330 this.lblPreviewColumnsInfo.AutoSize = true; 331 this.lblPreviewColumnsInfo.Location = new System.Drawing.Point(3, 3); 332 this.lblPreviewColumnsInfo.Name = "lblPreviewColumnsInfo"; 333 this.lblPreviewColumnsInfo.Size = new System.Drawing.Size(318, 13); 334 this.lblPreviewColumnsInfo.TabIndex = 1; 335 this.lblPreviewColumnsInfo.Text = "{0} columns with more than {1} % missing values would be deleted"; 336 // 310 337 // tabPreviewDeleteColumnsVariance 311 338 // 339 this.tabPreviewDeleteColumnsVariance.Controls.Add(this.label12); 340 this.tabPreviewDeleteColumnsVariance.Controls.Add(this.lblPreviewColumnsVariance); 312 341 this.tabPreviewDeleteColumnsVariance.Location = new System.Drawing.Point(4, 22); 313 342 this.tabPreviewDeleteColumnsVariance.Name = "tabPreviewDeleteColumnsVariance"; … … 318 347 this.tabPreviewDeleteColumnsVariance.UseVisualStyleBackColor = true; 319 348 // 349 // label12 350 // 351 this.label12.AutoSize = true; 352 this.label12.Location = new System.Drawing.Point(6, 22); 353 this.label12.Name = "label12"; 354 this.label12.Size = new System.Drawing.Size(0, 13); 355 this.label12.TabIndex = 2; 356 // 357 // lblPreviewColumnsVariance 358 // 359 this.lblPreviewColumnsVariance.AutoSize = true; 360 this.lblPreviewColumnsVariance.Location = new System.Drawing.Point(3, 3); 361 this.lblPreviewColumnsVariance.Name = "lblPreviewColumnsVariance"; 362 this.lblPreviewColumnsVariance.Size = new System.Drawing.Size(301, 13); 363 this.lblPreviewColumnsVariance.TabIndex = 2; 364 this.lblPreviewColumnsVariance.Text = "{0} columns with a variance smaller than {1} would be deleted."; 365 // 320 366 // tabPreviewDeleteRowsInfo 321 367 // 368 this.tabPreviewDeleteRowsInfo.Controls.Add(this.lblPreviewRowsInfo); 322 369 this.tabPreviewDeleteRowsInfo.Location = new System.Drawing.Point(4, 22); 323 370 this.tabPreviewDeleteRowsInfo.Name = "tabPreviewDeleteRowsInfo"; … … 328 375 this.tabPreviewDeleteRowsInfo.UseVisualStyleBackColor = true; 329 376 // 377 // lblPreviewRowsInfo 378 // 379 this.lblPreviewRowsInfo.AutoSize = true; 380 this.lblPreviewRowsInfo.Location = new System.Drawing.Point(3, 3); 381 this.lblPreviewRowsInfo.Name = "lblPreviewRowsInfo"; 382 this.lblPreviewRowsInfo.Size = new System.Drawing.Size(301, 13); 383 this.lblPreviewRowsInfo.TabIndex = 2; 384 this.lblPreviewRowsInfo.Text = "{0} rows with more than {1} % missing values would be deleted"; 385 // 330 386 // tabPreviewShuffle 331 387 // 332 this.tabPreviewShuffle.Controls.Add(this.l abel9);388 this.tabPreviewShuffle.Controls.Add(this.lblPreviewShuffle); 333 389 this.tabPreviewShuffle.Location = new System.Drawing.Point(4, 22); 334 390 this.tabPreviewShuffle.Name = "tabPreviewShuffle"; … … 339 395 this.tabPreviewShuffle.UseVisualStyleBackColor = true; 340 396 // 341 // label9 342 // 343 this.label9.AutoSize = true; 344 this.label9.Location = new System.Drawing.Point(3, 3); 345 this.label9.Name = "label9"; 346 this.label9.Size = new System.Drawing.Size(252, 13); 347 this.label9.TabIndex = 0; 348 this.label9.Text = "Data will be shuffled randomly - preview not possible"; 349 // 350 // tabPreviewInactive 351 // 352 this.tabPreviewInactive.Location = new System.Drawing.Point(4, 22); 353 this.tabPreviewInactive.Name = "tabPreviewInactive"; 354 this.tabPreviewInactive.Padding = new System.Windows.Forms.Padding(3); 355 this.tabPreviewInactive.Size = new System.Drawing.Size(711, 142); 356 this.tabPreviewInactive.TabIndex = 5; 357 this.tabPreviewInactive.Text = "inactive"; 358 this.tabPreviewInactive.UseVisualStyleBackColor = true; 397 // lblPreviewShuffle 398 // 399 this.lblPreviewShuffle.AutoSize = true; 400 this.lblPreviewShuffle.Location = new System.Drawing.Point(3, 3); 401 this.lblPreviewShuffle.Name = "lblPreviewShuffle"; 402 this.lblPreviewShuffle.Size = new System.Drawing.Size(252, 13); 403 this.lblPreviewShuffle.TabIndex = 0; 404 this.lblPreviewShuffle.Text = "Data will be shuffled randomly - preview not possible"; 359 405 // 360 406 // ManipulationView … … 382 428 this.grpBoxPreview.ResumeLayout(false); 383 429 this.tabsPreview.ResumeLayout(false); 430 this.tabPreviewDeleteColumnsInfo.ResumeLayout(false); 431 this.tabPreviewDeleteColumnsInfo.PerformLayout(); 432 this.tabPreviewDeleteColumnsVariance.ResumeLayout(false); 433 this.tabPreviewDeleteColumnsVariance.PerformLayout(); 434 this.tabPreviewDeleteRowsInfo.ResumeLayout(false); 435 this.tabPreviewDeleteRowsInfo.PerformLayout(); 384 436 this.tabPreviewShuffle.ResumeLayout(false); 385 437 this.tabPreviewShuffle.PerformLayout(); … … 415 467 private System.Windows.Forms.TabPage tabPage1; 416 468 private System.Windows.Forms.Label label7; 417 private System.Windows.Forms.Label l abel9;469 private System.Windows.Forms.Label lblPreviewShuffle; 418 470 private System.Windows.Forms.TabPage tabPreviewInactive; 471 private System.Windows.Forms.Label lblPreviewColumnsInfo; 472 private System.Windows.Forms.Label label12; 473 private System.Windows.Forms.Label lblPreviewColumnsVariance; 474 private System.Windows.Forms.Label lblPreviewRowsInfo; 419 475 } 420 476 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.3/ManipulationView.cs
r10712 r10737 45 45 46 46 validators = new Action[] { 47 ()=>validateD oubleTextBox(txtDeleteColumnsInfo.Text),48 ()=>validateD oubleTextBox(txtDeleteColumnsVariance.Text),49 ()=>validateD oubleTextBox(txtDeleteRowsInfo.Text),50 ()=>{btnApply.Enabled = true; } //shuffle47 ()=>validateDeleteColumnsInfo(), 48 ()=>validateDeleteColumnsVariance(), 49 ()=>validateDeleteRowsInfo(), 50 ()=>{btnApply.Enabled = true; lblPreviewShuffle.Text = "Data will be shuffled randomly - preview not possible";} //shuffle 51 51 }; 52 52 53 manipulations = new Action[] { 53 ()=> {},54 ()=> {},55 ()=> {},54 ()=>Content.ManipulationLogic.DeleteColumnsWithMissingValuesGreater(getDeleteColumnsInfo()), 55 ()=>Content.ManipulationLogic.DeleteColumnsWithVarianceSmaller(getDeleteColumnsVariance()), 56 ()=>Content.ManipulationLogic.DeleteRowsWithMissingValuesGreater(getRowsColumnsInfo()), 56 57 ()=>Content.ManipulationLogic.ShuffleWithRanges() 57 58 }; 59 } 60 61 protected override void RegisterContentEvents() { 62 base.RegisterContentEvents(); 63 Content.ManipulationLogic.Changed += Content_Changed; 64 } 65 66 protected override void DeregisterContentEvents() { 67 base.DeregisterContentEvents(); 68 Content.ManipulationLogic.Changed -= Content_Changed; 69 } 70 71 private double getDeleteColumnsInfo() { 72 return double.Parse(txtDeleteColumnsInfo.Text); 73 } 74 75 private double getDeleteColumnsVariance() { 76 return double.Parse(txtDeleteColumnsVariance.Text); 77 } 78 79 private double getRowsColumnsInfo() { 80 return double.Parse(txtDeleteRowsInfo.Text); 81 } 82 83 private void validateDeleteColumnsInfo() { 84 validateDoubleTextBox(txtDeleteColumnsInfo.Text); 85 if (btnApply.Enabled) { 86 int count = Content.ManipulationLogic.ColumnsWithMissingValuesGreater(getDeleteColumnsInfo()).Count; 87 lblPreviewColumnsInfo.Text = count + " column" + (count > 1 || count == 0 ? "s" : "") + " were detected with more than " + txtDeleteColumnsInfo.Text + "% missing values."; 88 if (count > 0) { 89 lblPreviewColumnsInfo.Text += Environment.NewLine + Environment.NewLine + "Please press the button \"Apply Manipulation\" if you wish to delete those columns."; 90 } else { 91 btnApply.Enabled = false; 92 } 93 } else { 94 lblPreviewColumnsInfo.Text = "Preview not possible yet - please input the limit above."; 95 } 96 } 97 98 private void validateDeleteColumnsVariance() { 99 validateDoubleTextBox(txtDeleteColumnsVariance.Text); 100 if (btnApply.Enabled) { 101 int count = Content.ManipulationLogic.ColumnsWithVarianceSmaller(getDeleteColumnsVariance()).Count; 102 lblPreviewColumnsVariance.Text = count + " column" + (count > 1 || count == 0 ? "s" : "") + " were detected with a variance smaller than " + txtDeleteColumnsVariance.Text + "."; 103 if (count > 0) { 104 lblPreviewColumnsVariance.Text += Environment.NewLine + Environment.NewLine + "Please press the button \"Apply Manipulation\" if you wish to delete those columns."; 105 } else { 106 btnApply.Enabled = false; 107 } 108 } else { 109 lblPreviewColumnsVariance.Text = "Preview not possible yet - please input the limit for the variance above."; 110 } 111 } 112 113 private void validateDeleteRowsInfo() { 114 validateDoubleTextBox(txtDeleteRowsInfo.Text); 115 if (btnApply.Enabled) { 116 int count = Content.ManipulationLogic.RowsWithMissingValuesGreater(getRowsColumnsInfo()).Count; 117 lblPreviewRowsInfo.Text = count + " row" + (count > 1 || count == 0 ? "s" : "") + " were detected with more than " + txtDeleteRowsInfo.Text + "% missing values."; 118 if (count > 0) { 119 lblPreviewRowsInfo.Text += Environment.NewLine + Environment.NewLine + "Please press the button \"Apply Manipulation\" if you wish to delete those rows."; 120 } else { 121 btnApply.Enabled = false; 122 } 123 } else { 124 lblPreviewRowsInfo.Text = "Preview not possible yet - please input the limit above."; 125 } 58 126 } 59 127 … … 70 138 btnApply.Enabled = false; 71 139 72 //in order that button will be enabled if text is already valid140 //in order that button is enabled if necessary input was already entered 73 141 if (index >= 0) { 74 142 validators[index](); … … 78 146 private void btnApply_Click(object sender, System.EventArgs e) { 79 147 manipulations[lstMethods.SelectedIndex](); 148 switch (lstMethods.SelectedIndex) { 149 case 0: 150 lblPreviewColumnsInfo.Text = "columns successfully deleted."; 151 break; 152 case 1: 153 lblPreviewColumnsVariance.Text = "columns successfully deleted."; 154 break; 155 case 2: 156 lblPreviewRowsInfo.Text = "rows successfully deleted."; 157 break; 158 case 3: 159 lblPreviewShuffle.Text = "dataset shuffled successfully."; 160 btnApply.Enabled = false; 161 break; 162 } 80 163 } 81 164 … … 91 174 92 175 private void txtDeleteColumnsInfo_TextChanged(object sender, EventArgs e) { 93 validateD oubleTextBox(txtDeleteColumnsInfo.Text);176 validateDeleteColumnsInfo(); 94 177 } 95 178 96 179 private void txtDeleteColumnsVariance_TextChanged(object sender, EventArgs e) { 97 validateD oubleTextBox(txtDeleteColumnsVariance.Text);180 validateDeleteColumnsVariance(); 98 181 } 99 182 100 183 private void txtDeleteRowsInfo_TextChanged(object sender, EventArgs e) { 101 validateDoubleTextBox(txtDeleteRowsInfo.Text); 184 validateDeleteRowsInfo(); 185 } 186 187 void Content_Changed(object sender, DataPreprocessingChangedEventArgs e) { 188 switch(lstMethods.SelectedIndex){ 189 case 0: 190 validateDeleteColumnsInfo(); 191 break; 192 case 1: 193 validateDeleteColumnsVariance(); 194 break; 195 case 2: 196 validateDeleteRowsInfo(); 197 break; 198 } 102 199 } 103 200 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ManipulationLogic.cs
r10718 r10737 299 299 List<int> rows= new List<int>(); 300 300 301 for (int i = preprocessingData.Rows - 1; i >= 0; --i)301 for (int i = 0; i < preprocessingData.Rows; ++i) 302 302 { 303 303 int missingCount = statisticsLogic.GetRowMissingValueCount(i); 304 if (100f / preprocessingData.Columns * missingCount > =percent)304 if (100f / preprocessingData.Columns * missingCount > percent) 305 305 { 306 306 rows.Add(i); … … 314 314 315 315 List<int> columns = new List<int>(); 316 for (int i = preprocessingData.Columns - 1; i >= 0; --i) 317 { 316 for (int i = 0; i < preprocessingData.Columns; ++i) { 318 317 int missingCount = statisticsLogic.GetMissingValueCount(i); 319 if (100f / preprocessingData.Columns * missingCount >= percent) 320 { 318 if (100f / preprocessingData.Rows * missingCount > percent) { 321 319 columns.Add(i); 322 320 } … … 329 327 330 328 List<int> columns = new List<int>(); 331 for (int i = preprocessingData.Columns - 1; i >= 0; --i) 332 { 329 for (int i = 0; i < preprocessingData.Columns; ++i) { 333 330 if (preprocessingData.IsType<double>(i) || preprocessingData.IsType<DateTime>(i)) 334 331 { … … 355 352 } 356 353 357 private void DeleteRows(IEnumerable<int> rows) { 354 private void DeleteRows(List<int> rows) { 355 rows.Sort(); 356 rows.Reverse(); 358 357 preprocessingData.InTransaction(() => 359 358 { … … 365 364 } 366 365 367 private void DeleteColumns(IEnumerable<int> columns) { 366 private void DeleteColumns(List<int> columns) { 367 columns.Sort(); 368 columns.Reverse(); 368 369 preprocessingData.InTransaction(() => 369 370 { … … 373 374 } 374 375 }); 376 } 377 378 public event DataPreprocessingChangedEventHandler Changed { 379 add { dataGridLogic.Changed += value; } 380 remove { dataGridLogic.Changed -= value; } 375 381 } 376 382 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/SearchLogic.cs
r10661 r10737 43 43 void preprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e) 44 44 { 45 MissingValueIndicies.Remove(e.Column); 46 ValuesWithoutNaN.Remove(e.Column); 45 switch (e.Type) { 46 case DataPreprocessingChangedEventType.DeleteColumn: 47 case DataPreprocessingChangedEventType.ChangeColumn: 48 MissingValueIndicies.Remove(e.Column); 49 ValuesWithoutNaN.Remove(e.Column); 50 break; 51 case DataPreprocessingChangedEventType.AddColumn: 52 //cache does not need to be updated, will be calculated the first time it is requested 53 break; 54 case DataPreprocessingChangedEventType.DeleteRow: 55 case DataPreprocessingChangedEventType.AddRow: 56 case DataPreprocessingChangedEventType.ChangeItem: 57 case DataPreprocessingChangedEventType.Any: 58 case DataPreprocessingChangedEventType.Transformation: 59 MissingValueIndicies = new Dictionary<int, IEnumerable<int>>(); 60 ValuesWithoutNaN = new Dictionary<int, IEnumerable>(); 61 break; 62 } 47 63 } 48 64 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IManipulationLogic.cs
r10718 r10737 43 43 void DeleteColumnsWithMissingValuesGreater(double percent); 44 44 void DeleteColumnsWithVarianceSmaller(double variance); 45 46 event DataPreprocessingChangedEventHandler Changed; 45 47 } 46 48 }
Note: See TracChangeset
for help on using the changeset viewer.