- Timestamp:
- 03/19/14 13:24:38 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridLogic.cs
r10616 r10621 124 124 remove { preprocessingData.Changed -= value; } 125 125 } 126 127 public bool AreAllStringColumns(IEnumerable<int> columnIndices) { 128 return columnIndices.All(x => preprocessingData.IsType<string>(x)); 129 } 126 130 } 127 131 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ManipulationLogic.cs
r10615 r10621 100 100 preprocessingData.InTransaction(() => { 101 101 foreach (var column in cells) { 102 if (preprocessingData.IsType<double>(column.Key)) { 103 int countValues = preprocessingData.GetValues<double>(column.Key).Count(); 104 foreach (int index in column.Value) { 105 // dont replace first or last values 106 if (index > 0 && index < countValues) { 107 int prevIndex = indexOfPrevPresentValue(column.Key, index); 108 int nextIndex = indexOfNextPresentValue(column.Key, index); 109 110 // no neighbours found 111 if (prevIndex < 0 && nextIndex >= countValues) { 112 continue; 113 } 102 int countValues = 0; 103 if (preprocessingData.IsType<double>(column.Key)) { 104 countValues = preprocessingData.GetValues<double>(column.Key).Count(); 105 } else if (preprocessingData.IsType<DateTime>(column.Key)) { 106 countValues = preprocessingData.GetValues<DateTime>(column.Key).Count(); 107 } 108 109 foreach (int index in column.Value) { 110 // dont replace first or last values 111 if (index > 0 && index < countValues) { 112 int prevIndex = indexOfPrevPresentValue(column.Key, index); 113 int nextIndex = indexOfNextPresentValue(column.Key, index); 114 115 // no neighbours found 116 if (prevIndex < 0 && nextIndex >= countValues) { 117 continue; 118 } 119 120 int valuesToInterpolate = nextIndex - prevIndex; 121 122 if (preprocessingData.IsType<double>(column.Key)) { 114 123 double prev = preprocessingData.GetCell<double>(column.Key, prevIndex); 115 124 double next = preprocessingData.GetCell<double>(column.Key, nextIndex); 116 117 int valuesToInterpolate = nextIndex - prevIndex;118 119 125 double interpolationStep = (next - prev) / valuesToInterpolate; 120 126 … … 123 129 preprocessingData.SetCell<double>(column.Key, i, interpolated); 124 130 } 125 } 126 } 127 } else if (preprocessingData.IsType<DateTime>(column.Key)) { 128 int countValues = preprocessingData.GetValues<DateTime>(column.Key).Count(); 129 foreach (int index in column.Value) { 130 // dont replace first or last values 131 if (index > 0 && index < countValues) { 132 int prevIndex = indexOfPrevPresentValue(column.Key, index); 133 int nextIndex = indexOfNextPresentValue(column.Key, index); 134 135 // no neighbours found 136 if (prevIndex < 0 && nextIndex >= countValues) { 137 continue; 138 } 131 } else if (preprocessingData.IsType<DateTime>(column.Key)) { 139 132 DateTime prev = preprocessingData.GetCell<DateTime>(column.Key, prevIndex); 140 133 DateTime next = preprocessingData.GetCell<DateTime>(column.Key, nextIndex); 141 142 int valuesToInterpolate = nextIndex - prevIndex;143 144 134 double interpolationStep = (next - prev).TotalSeconds / valuesToInterpolate; 145 135
Note: See TracChangeset
for help on using the changeset viewer.