- Timestamp:
- 04/02/14 16:08:56 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/ManipulationLogic.cs
r10715 r10718 203 203 } 204 204 205 ReOrderToIndices(shuffledIndices);205 ShuffleToIndices(shuffledIndices); 206 206 } 207 207 }); … … 232 232 } 233 233 234 public void ShuffleToIndices(IList<System.Tuple<int, int>> indices) 235 { 236 preprocessingData.InTransaction(() => 237 { 238 for (int i = 0; i < preprocessingData.Columns; ++i) 239 { 240 if (preprocessingData.IsType<double>(i)) 241 { 242 ShuffleToIndices<double>(i, indices); 243 } 244 else if (preprocessingData.IsType<string>(i)) 245 { 246 ShuffleToIndices<string>(i, indices); 247 } 248 else if (preprocessingData.IsType<DateTime>(i)) 249 { 250 ShuffleToIndices<DateTime>(i, indices); 251 } 252 } 253 }); 254 } 255 234 256 private void reOrderToIndices<T>(int columnIndex, IList<Tuple<int, int>> indices) { 235 257 … … 246 268 } 247 269 270 private void ShuffleToIndices<T>(int columnIndex, IList<Tuple<int, int>> indices) 271 { 272 // process all columns equally 273 foreach (Tuple<int, int> index in indices) 274 { 275 int originalIndex = index.Item1; 276 int replaceIndex = index.Item2; 277 278 T tmp = preprocessingData.GetCell<T>(columnIndex, originalIndex); 279 T replaceValue = preprocessingData.GetCell<T>(columnIndex, replaceIndex); 280 281 preprocessingData.SetCell<T>(columnIndex, originalIndex, replaceValue); 282 preprocessingData.SetCell<T>(columnIndex, replaceIndex, tmp); 283 } 284 } 285 248 286 public void ReplaceIndicesByValue(IDictionary<int, IList<int>> cells, string value) { 249 287 preprocessingData.InTransaction(() => { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IManipulationLogic.cs
r10715 r10718 27 27 void ReOrderToIndices(IEnumerable<int> indices); 28 28 void ReOrderToIndices(IList<Tuple<int, int>> indices); 29 void ShuffleToIndices(IList<System.Tuple<int, int>> indices); 29 30 void ReplaceIndicesByAverageValue(IDictionary<int, IList<int>> cells); 30 31 void ReplaceIndicesByLinearInterpolationOfNeighbours(IDictionary<int, IList<int>> cells);
Note: See TracChangeset
for help on using the changeset viewer.