Changeset 12689 for branches/HiveStatistics/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/SearchLogic.cs
- Timestamp:
- 07/08/15 15:32:12 (9 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
-
branches/HiveStatistics/sources/HeuristicLab.DataPreprocessing/3.4
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/stable/HeuristicLab.DataPreprocessing/3.4 merged eligible /trunk/sources/HeuristicLab.DataPreprocessing/3.4 merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.DataPreprocessing/3.4 10321-10322 /branches/1721-RandomForestPersistence/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.DataPreprocessing/3.4 5516-5520 /branches/Algorithms.GradientDescent/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5516-5520 /branches/Benchmarking/sources/HeuristicLab.DataPreprocessing/3.4 6917-7005 /branches/Benchmarking/sources/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6917-7005 /branches/CloningRefactoring/HeuristicLab.DataPreprocessing/3.4 4656-4721 /branches/CloningRefactoring/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 4656-4721 /branches/CodeEditor/HeuristicLab.DataPreprocessing/3.4 11700-11806 /branches/CodeEditor/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.DataPreprocessing/3.4 5471-5808 /branches/DataAnalysis Refactoring/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.DataPreprocessing/3.4 5815-6180 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5815-6180 /branches/DataAnalysis/HeuristicLab.DataPreprocessing/3.4 4458-4459,4462,4464 /branches/DataAnalysis/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10085-11101 /branches/DataPreprocessing/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10085-11101 /branches/DataPreprocessingImprovements/3.4 12051 /branches/DataPreprocessingImprovements/HeuristicLab.DataPreprocessing/3.4 12053-12675 /branches/GP.Grammar.Editor/HeuristicLab.DataPreprocessing/3.4 6284-6795 /branches/GP.Grammar.Editor/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.DataPreprocessing/3.4 5060 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5060 /branches/HLScript/HeuristicLab.DataPreprocessing/3.4 10331-10358 /branches/HLScript/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.DataPreprocessing/3.4 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.DataPreprocessing/3.4 6123-9799 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6123-9799 /branches/LogResidualEvaluator/HeuristicLab.DataPreprocessing/3.4 10202-10483 /branches/LogResidualEvaluator/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10202-10483 /branches/NET40/sources/HeuristicLab.DataPreprocessing/3.4 5138-5162 /branches/NET40/sources/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5138-5162 /branches/NSGA-II Changes/HeuristicLab.DataPreprocessing/3.4 12033-12122 /branches/ParallelEngine/HeuristicLab.DataPreprocessing/3.4 5175-5192 /branches/ParallelEngine/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.DataPreprocessing/3.4 7568-7810 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 7568-7810 /branches/QAPAlgorithms/HeuristicLab.DataPreprocessing/3.4 6350-6627 /branches/QAPAlgorithms/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6350-6627 /branches/Restructure trunk solution/HeuristicLab.DataPreprocessing/3.4 6828 /branches/Restructure trunk solution/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6828 /branches/RuntimeOptimizer/HeuristicLab.DataPreprocessing/3.4 8943-9078 /branches/RuntimeOptimizer/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.DataPreprocessing/3.4 7787-8333 /branches/ScatterSearch (trunk integration)/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 7787-8333 /branches/SlaveShutdown/HeuristicLab.DataPreprocessing/3.4 8944-8956 /branches/SlaveShutdown/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.DataPreprocessing/3.4 10204-10479 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.DataPreprocessing/3.4 5370-5682 /branches/SuccessProgressAnalysis/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5370-5682 /branches/Trunk/HeuristicLab.DataPreprocessing/3.4 6829-6865 /branches/Trunk/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 6829-6865 /branches/UnloadJobs/HeuristicLab.DataPreprocessing/3.4 9168-9215 /branches/UnloadJobs/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 9168-9215 /branches/VNS/HeuristicLab.DataPreprocessing/3.4 5594-5752 /branches/VNS/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5594-5752 /branches/histogram/HeuristicLab.DataPreprocessing/3.4 5959-6341 /branches/histogram/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 5959-6341 /stable/HeuristicLab.DataPreprocessing/HeuristicLab.DataPreprocessing/3.4 10032-10033,11170,11173,11175,12008-12010
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/HiveStatistics/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/SearchLogic.cs
r12012 r12689 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Linq;26 25 27 26 namespace HeuristicLab.DataPreprocessing { 28 27 public class SearchLogic : ISearchLogic { 29 28 private readonly ITransactionalPreprocessingData preprocessingData; 29 private readonly IFilterLogic filterLogic; 30 30 31 31 private Dictionary<int, IList<int>> MissingValueIndicies { get; set; } … … 44 44 } 45 45 46 public SearchLogic(ITransactionalPreprocessingData thePreprocessingData ) {46 public SearchLogic(ITransactionalPreprocessingData thePreprocessingData, IFilterLogic theFilterLogic) { 47 47 preprocessingData = thePreprocessingData; 48 filterLogic = theFilterLogic; 48 49 49 50 MissingValueIndicies = new Dictionary<int, IList<int>>(); 50 51 ValuesWithoutNaN = new Dictionary<int, IList>(); 51 52 52 preprocessingData.Changed += preprocessingData_Changed; 53 preprocessingData.Changed += PreprocessingData_Changed; 54 filterLogic.FilterChanged += FilterLogic_FilterChanged; 53 55 } 54 56 55 void preprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e) 56 { 57 void FilterLogic_FilterChanged(object sender, EventArgs e) { 58 //recalculate 59 for (int i = 0; i < Columns; i++) { 60 MissingValueIndicies.Remove(i); 61 ValuesWithoutNaN.Remove(i); 62 } 63 } 64 65 void PreprocessingData_Changed(object sender, DataPreprocessingChangedEventArgs e) { 57 66 switch (e.Type) { 58 67 case DataPreprocessingChangedEventType.DeleteColumn: … … 73 82 ValuesWithoutNaN = new Dictionary<int, IList>(); 74 83 break; 75 } 84 } 76 85 } 77 86 … … 97 106 98 107 public IList<int> GetMissingValueIndices(int columnIndex) { 99 if (!MissingValueIndicies.ContainsKey(columnIndex)){ 100 if (preprocessingData.VariableHasType<double>(columnIndex)) { 101 MissingValueIndicies[columnIndex] = GetMissingValueIndices<double>(columnIndex); 102 } else if (preprocessingData.VariableHasType<string>(columnIndex)) { 103 MissingValueIndicies[columnIndex] = GetMissingValueIndices<string>(columnIndex); 104 } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) { 105 MissingValueIndicies[columnIndex] = GetMissingValueIndices<DateTime>(columnIndex); 106 } else { 107 throw new ArgumentException("column " + columnIndex + " contains a non supported type."); 108 } 109 } 108 if (!MissingValueIndicies.ContainsKey(columnIndex)) { 109 if (preprocessingData.VariableHasType<double>(columnIndex)) { 110 MissingValueIndicies[columnIndex] = GetMissingValueIndices<double>(columnIndex); 111 } else if (preprocessingData.VariableHasType<string>(columnIndex)) { 112 MissingValueIndicies[columnIndex] = GetMissingValueIndices<string>(columnIndex); 113 } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) { 114 MissingValueIndicies[columnIndex] = GetMissingValueIndices<DateTime>(columnIndex); 115 } else { 116 throw new ArgumentException("column " + columnIndex + " contains a non supported type."); 117 } 118 } 119 return MissingValueIndicies[columnIndex]; 120 } 110 121 111 return MissingValueIndicies[columnIndex];112 }113 122 private IList<int> GetMissingValueIndices<T>(int columnIndex) { 114 123 List<int> missingIndices = new List<int>(); 115 116 for (int row = 0; row < preprocessingData.Rows; ++row) {124 125 for (int row = 0; row < preprocessingData.Rows; ++row) { 117 126 if (IsMissingValue(columnIndex, row)) { 118 127 missingIndices.Add(row); … … 123 132 } 124 133 125 public IEnumerable<T> GetValuesWithoutNaN<T>(int columnIndex, bool considerSelection) 126 { 127 if (considerSelection) { 128 var selectedRows = preprocessingData.Selection[columnIndex]; 129 134 public IEnumerable<T> GetValuesWithoutNaN<T>(int columnIndex, bool considerSelection) { 135 if (considerSelection) { 136 var selectedRows = preprocessingData.Selection[columnIndex]; 137 130 138 List<T> values = new List<T>(); 131 139 foreach (var rowIdx in selectedRows) {
Note: See TracChangeset
for help on using the changeset viewer.