Changeset 15012
- Timestamp:
- 05/31/17 14:12:56 (7 years ago)
- Location:
- branches/DataPreprocessing Enhancements
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.DataPreprocessing merged: 14826,14843,14886,14947
- Property svn:mergeinfo changed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views
- Property svn:mergeinfo changed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/CheckedFilterCollectionView.cs
r14996 r15012 34 34 InitializeComponent(); 35 35 } 36 37 protected override void addButton_Click(object sender, EventArgs e) {38 IFilter filter = new ComparisonFilter();39 Content.Add(filter);40 Content.SetItemCheckedState(filter, false);41 }42 43 36 } 44 37 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing.Views/3.4/HeuristicLab.DataPreprocessing.Views-3.4.csproj
r14915 r15012 178 178 <ItemGroup> 179 179 <Compile Include="DataPreprocessingMenuItem.cs" /> 180 <Compile Include="PreprocessingCh artView.cs">181 <SubType>UserControl</SubType> 182 </Compile> 183 <Compile Include="PreprocessingCh artView.Designer.cs">184 <DependentUpon>PreprocessingCh artView.cs</DependentUpon>180 <Compile Include="PreprocessingCheckedVariablesView.cs"> 181 <SubType>UserControl</SubType> 182 </Compile> 183 <Compile Include="PreprocessingCheckedVariablesView.Designer.cs"> 184 <DependentUpon>PreprocessingCheckedVariablesView.cs</DependentUpon> 185 185 </Compile> 186 186 <Compile Include="PreprocessingFeatureCorrelationView.cs"> … … 281 281 </Compile> 282 282 <Compile Include="Plugin.cs" /> 283 <Compile Include="PreprocessingCh eckedVariablesView.cs">284 <SubType>UserControl</SubType> 285 </Compile> 286 <Compile Include="PreprocessingCh eckedVariablesView.Designer.cs">287 <DependentUpon>PreprocessingCh eckedVariablesView.cs</DependentUpon>283 <Compile Include="PreprocessingChartView.cs"> 284 <SubType>UserControl</SubType> 285 </Compile> 286 <Compile Include="PreprocessingChartView.Designer.cs"> 287 <DependentUpon>PreprocessingChartView.cs</DependentUpon> 288 288 </Compile> 289 289 <Compile Include="Properties\AssemblyInfo.cs" /> -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4
- Property svn:mergeinfo changed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs
r14996 r15012 145 145 146 146 private void CheckPartitionRanges() { 147 int maxRowIndex = Math.Max(0, Rows - 1);147 int maxRowIndex = Math.Max(0, Rows); 148 148 TrainingPartition.Start = Math.Min(TrainingPartition.Start, maxRowIndex); 149 149 TrainingPartition.End = Math.Min(TrainingPartition.End, maxRowIndex); -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj
r14473 r15012 126 126 <SpecificVersion>False</SpecificVersion> 127 127 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.dll</HintPath> 128 </Reference> 129 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 130 <SpecificVersion>False</SpecificVersion> 131 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> 128 132 </Reference> 129 133 <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Logic/ManipulationLogic.cs
r14996 r15012 24 24 using System.Linq; 25 25 using HeuristicLab.Data; 26 using HeuristicLab.Random; 26 27 27 28 namespace HeuristicLab.DataPreprocessing { … … 81 82 public void ReplaceIndicesByRandomValue(IDictionary<int, IList<int>> cells, bool considerSelection = false) { 82 83 preprocessingData.InTransaction(() => { 83 Random r = newRandom();84 System.Random r = new System.Random(); 84 85 85 86 foreach (var column in cells) { … … 219 220 220 221 public void Shuffle(bool shuffleRangesSeparately) { 221 Random random = newRandom();222 var ranges = new[] { preprocessingData.TestPartition, preprocessingData.TrainingPartition }; 222 var random = new FastRandom(); 223 223 224 if (shuffleRangesSeparately) { 225 var ranges = new[] { preprocessingData.TestPartition, preprocessingData.TrainingPartition }; 224 226 preprocessingData.InTransaction(() => { 225 227 // process all given ranges - e.g. TrainingPartition, TestPartition 226 228 foreach (IntRange range in ranges) { 227 List<Tuple<int, int>> shuffledIndices = new List<Tuple<int, int>>(); 228 229 // generate random indices used for shuffeling each column 230 for (int i = range.End - 1; i >= range.Start; --i) { 231 int rand = random.Next(range.Start, i); 232 shuffledIndices.Add(new Tuple<int, int>(i, rand)); 233 } 234 235 ShuffleToIndices(shuffledIndices); 229 var indices = Enumerable.Range(0, preprocessingData.Rows).ToArray(); 230 var shuffledIndices = Enumerable.Range(range.Start, range.Size).Shuffle(random).ToArray(); 231 for (int i = range.Start, j = 0; i < range.End; i++, j++) 232 indices[i] = shuffledIndices[j]; 233 234 ReOrderToIndices(indices); 236 235 } 237 236 }); 237 238 238 } else { 239 239 preprocessingData.InTransaction(() => { 240 var indices = ranges.SelectMany(x => Enumerable.Range(x.Start, x.Size)).ToList();241 var shuffledIndices = indices. OrderBy(x => random.Next());242 ShuffleToIndices(indices.Zip(shuffledIndices, (i, j) => new Tuple<int, int>(i, j)).ToList());240 var indices = Enumerable.Range(0, preprocessingData.Rows); 241 var shuffledIndices = indices.Shuffle(random).ToArray(); 242 ReOrderToIndices(shuffledIndices); 243 243 }); 244 244 } 245 245 } 246 246 247 public void ReOrderToIndices(IEnumerable<int> indices) { 248 List<Tuple<int, int>> indicesTuple = new List<Tuple<int, int>>(); 249 250 for (int i = 0; i < indices.Count(); ++i) { 251 indicesTuple.Add(new Tuple<int, int>(i, indices.ElementAt(i))); 252 } 253 254 ReOrderToIndices(indicesTuple); 255 } 256 257 public void ReOrderToIndices(IList<System.Tuple<int, int>> indices) { 247 public void ReOrderToIndices(int[] indices) { 258 248 preprocessingData.InTransaction(() => { 259 249 for (int i = 0; i < preprocessingData.Columns; ++i) { … … 269 259 } 270 260 271 public void ShuffleToIndices(IList<System.Tuple<int, int>> indices) { 272 preprocessingData.InTransaction(() => { 273 for (int i = 0; i < preprocessingData.Columns; ++i) { 274 if (preprocessingData.VariableHasType<double>(i)) { 275 ShuffleToIndices<double>(i, indices); 276 } else if (preprocessingData.VariableHasType<string>(i)) { 277 ShuffleToIndices<string>(i, indices); 278 } else if (preprocessingData.VariableHasType<DateTime>(i)) { 279 ShuffleToIndices<DateTime>(i, indices); 280 } 281 } 282 }); 283 } 284 285 private void ReOrderToIndices<T>(int columnIndex, IList<Tuple<int, int>> indices) { 261 private void ReOrderToIndices<T>(int columnIndex, int[] indices) { 286 262 List<T> originalData = new List<T>(preprocessingData.GetValues<T>(columnIndex)); 287 288 // process all columns equally 289 for each (Tuple<int, int> index in indices) {290 int originalIndex = i ndex.Item1;291 int replaceIndex = ind ex.Item2;263 if (indices.Length != originalData.Count) throw new InvalidOperationException("The number of provided indices does not match the values."); 264 265 for (int i = 0; i < indices.Length; i++) { 266 int originalIndex = i; 267 int replaceIndex = indices[i]; 292 268 293 269 T replaceValue = originalData.ElementAt<T>(replaceIndex); 294 270 preprocessingData.SetCell<T>(columnIndex, originalIndex, replaceValue); 295 }296 }297 298 private void ShuffleToIndices<T>(int columnIndex, IList<Tuple<int, int>> indices) {299 // process all columns equally300 foreach (Tuple<int, int> index in indices) {301 int originalIndex = index.Item1;302 int replaceIndex = index.Item2;303 304 T tmp = preprocessingData.GetCell<T>(columnIndex, originalIndex);305 T replaceValue = preprocessingData.GetCell<T>(columnIndex, replaceIndex);306 307 preprocessingData.SetCell<T>(columnIndex, originalIndex, replaceValue);308 preprocessingData.SetCell<T>(columnIndex, replaceIndex, tmp);309 271 } 310 272 } -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Plugin.cs.frame
r14472 r15012 37 37 [PluginDependency("HeuristicLab.Persistence", "3.3")] 38 38 [PluginDependency("HeuristicLab.Problems.DataAnalysis","3.4")] 39 [PluginDependency("HeuristicLab.Random", "3.3")] 39 40 [PluginDependency("HeuristicLab.Visualization.ChartControlsExtensions", "3.3")] 40 41 public class HeuristicLabDataPreprocessingPlugin : PluginBase { -
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/PreprocessingTransformator.cs
r14400 r15012 113 113 // don't apply when the check fails 114 114 if (success) 115 return transformation. Apply(data);115 return transformation.ConfigureAndApply(data); 116 116 else 117 117 return data;
Note: See TracChangeset
for help on using the changeset viewer.