- Timestamp:
- 07/01/14 15:49:31 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/HeuristicLab.DataPreprocessing-3.4.csproj
r11002 r11068 179 179 <Private>False</Private> 180 180 </ProjectReference> 181 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Transformations\3.4\HeuristicLab.Problems.DataAnalysis.Transformations-3.4.csproj">182 <Project>{2e257a94-d1af-435c-99b4-5ac00eadfd6a}</Project>183 <Name>HeuristicLab.Problems.DataAnalysis.Transformations-3.4</Name>184 <Private>False</Private>185 </ProjectReference>186 181 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj"> 187 182 <Project>{df87c13e-a889-46ff-8153-66dcaa8c5674}</Project> -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/FilteredPreprocessingData.cs
r11003 r11068 6 6 using HeuristicLab.DataPreprocessing.Interfaces; 7 7 using HeuristicLab.Problems.DataAnalysis; 8 using HeuristicLab.Problems.DataAnalysis.Transformations;9 8 10 9 namespace HeuristicLab.DataPreprocessing.Implementations { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingData.cs
r11002 r11068 23 23 using System.Collections; 24 24 using System.Collections.Generic; 25 using System.Globalization;26 25 using System.Linq; 27 26 using HeuristicLab.Common; … … 29 28 using HeuristicLab.Data; 30 29 using HeuristicLab.Problems.DataAnalysis; 31 using HeuristicLab.Problems.DataAnalysis.Transformations;32 30 33 31 namespace HeuristicLab.DataPreprocessing { … … 116 114 TrainingPartition = new IntRange(problemData.TrainingPartition.Start, problemData.TrainingPartition.End); 117 115 TestPartition = new IntRange(problemData.TestPartition.Start, problemData.TestPartition.End); 118 116 119 117 RegisterEventHandler(); 120 118 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransactionalPreprocessingData.cs
r11002 r11068 29 29 using HeuristicLab.Data; 30 30 using HeuristicLab.Problems.DataAnalysis; 31 using HeuristicLab.Problems.DataAnalysis.Transformations;32 31 33 32 namespace HeuristicLab.DataPreprocessing { … … 62 61 private TransactionalPreprocessingData(TransactionalPreprocessingData original, Cloner cloner) 63 62 : base(original, cloner) { 64 63 } 65 64 66 65 private void SaveSnapshot(DataPreprocessingChangedEventType changedType, int column, int row) { … … 94 93 #region Overridden IPreprocessingData Members 95 94 96 public override T GetCell<T>(int columnIndex, int rowIndex) 97 { 95 public override T GetCell<T>(int columnIndex, int rowIndex) { 98 96 return (T)variableValues[columnIndex][rowIndex]; 99 97 } … … 106 104 } 107 105 108 public override string GetCellAsString(int columnIndex, int rowIndex) 109 { 106 public override string GetCellAsString(int columnIndex, int rowIndex) { 110 107 return variableValues[columnIndex][rowIndex].ToString(); 111 108 } 112 109 113 public override string GetVariableName(int columnIndex) 114 { 110 public override string GetVariableName(int columnIndex) { 115 111 return variableNames[columnIndex]; 116 112 } 117 113 118 public override int GetColumnIndex(string variableName) 119 { 114 public override int GetColumnIndex(string variableName) { 120 115 return variableNames.IndexOf(variableName); 121 116 } 122 117 123 public override bool IsType<T>(int columnIndex) 124 { 118 public override bool IsType<T>(int columnIndex) { 125 119 return variableValues[columnIndex] is List<T>; 126 120 } 127 121 128 122 [Obsolete("use the index based variant, is faster")] 129 public override IList<T> GetValues<T>(string variableName, bool considerSelection) 130 { 123 public override IList<T> GetValues<T>(string variableName, bool considerSelection) { 131 124 return GetValues<T>(GetColumnIndex(variableName), considerSelection); 132 125 } 133 126 134 public override IList<T> GetValues<T>(int columnIndex, bool considerSelection) 135 { 136 if (considerSelection) 137 { 127 public override IList<T> GetValues<T>(int columnIndex, bool considerSelection) { 128 if (considerSelection) { 138 129 var list = new List<T>(); 139 foreach (var rowIdx in selection[columnIndex]) 140 { 130 foreach (var rowIdx in selection[columnIndex]) { 141 131 list.Add((T)variableValues[columnIndex][rowIdx]); 142 132 } 143 133 return list; 144 } 145 else 146 { 134 } else { 147 135 return (IList<T>)variableValues[columnIndex]; 148 136 } … … 151 139 public override void SetValues<T>(int columnIndex, IList<T> values) { 152 140 SaveSnapshot(DataPreprocessingChangedEventType.ChangeColumn, columnIndex, -1); 153 if (IsType<T>(columnIndex)) 154 { 141 if (IsType<T>(columnIndex)) { 155 142 variableValues[columnIndex] = (IList)values; 156 } 157 else 158 { 143 } else { 159 144 throw new ArgumentException("The datatype of column " + columnIndex + " must be of type " + variableValues[columnIndex].GetType().Name + " but was " + typeof(T).Name); 160 145 } … … 185 170 return valid; 186 171 } 187 188 public override bool Validate(string value, out string errorMessage, int columnIndex) {189 if (columnIndex < 0 || columnIndex > VariableNames.Count()) {172 173 public override bool Validate(string value, out string errorMessage, int columnIndex) { 174 if (columnIndex < 0 || columnIndex > VariableNames.Count()) { 190 175 throw new ArgumentOutOfRangeException("column index is out of range"); 191 176 } … … 234 219 public override void InsertRow(int rowIndex) { 235 220 SaveSnapshot(DataPreprocessingChangedEventType.DeleteRow, -1, rowIndex); 236 foreach (IList column in variableValues) 237 { 221 foreach (IList column in variableValues) { 238 222 Type type = column.GetType().GetGenericArguments()[0]; 239 223 column.Insert(rowIndex, type.IsValueType ? Activator.CreateInstance(type) : null); … … 245 229 public override void DeleteRow(int rowIndex) { 246 230 SaveSnapshot(DataPreprocessingChangedEventType.AddRow, -1, rowIndex); 247 foreach (IList column in variableValues) 248 { 231 foreach (IList column in variableValues) { 249 232 column.RemoveAt(rowIndex); 250 233 } … … 269 252 } 270 253 271 public override Dataset ExportToDataset() 272 { 254 public override Dataset ExportToDataset() { 273 255 IList<IList> values = new List<IList>(); 274 256 275 for (int i = 0; i < Columns; ++i) 276 { 257 for (int i = 0; i < Columns; ++i) { 277 258 values.Add(variableValues[i]); 278 259 } … … 282 263 } 283 264 284 public override void ClearSelection() 285 { 265 public override void ClearSelection() { 286 266 Selection = new Dictionary<int, IList<int>>(); 287 267 } … … 289 269 public override event EventHandler SelectionChanged; 290 270 291 protected override void OnSelectionChanged() 292 { 271 protected override void OnSelectionChanged() { 293 272 var listeners = SelectionChanged; 294 273 if (listeners != null) listeners(this, EventArgs.Empty); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/TransformationContent.cs
r11001 r11068 23 23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 using HeuristicLab.Problems.DataAnalysis .Transformations;25 using HeuristicLab.Problems.DataAnalysis; 26 26 27 27 namespace HeuristicLab.DataPreprocessing { … … 36 36 public static new Image StaticItemImage { 37 37 get { return HeuristicLab.Common.Resources.VSImageLibrary.Method; } 38 } 38 } 39 39 40 40 public TransformationContent(IPreprocessingData data, IFilterLogic filterLogic) { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Interfaces/IPreprocessingData.cs
r11002 r11068 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Problems.DataAnalysis; 27 using HeuristicLab.Problems.DataAnalysis.Transformations;28 27 29 28 namespace HeuristicLab.DataPreprocessing { … … 52 51 bool AreAllStringColumns(IEnumerable<int> columnIndices); 53 52 bool Validate(string value, out string errorMessage, int columnIndex); 54 55 53 54 IntRange TrainingPartition { get; } 56 55 IntRange TestPartition { get; } 57 56 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Plugin.cs.frame
r10925 r11068 44 44 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")] 45 45 [PluginDependency("HeuristicLab.Parameters","3.3")] 46 [PluginDependency("HeuristicLab.Persistence","3.3")] 47 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Transformations", "3.4")] 46 [PluginDependency("HeuristicLab.Persistence","3.3")] 48 47 public class HeuristicLabDataPreprocessingPlugin : PluginBase { 49 48 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/PreprocessingTransformator.cs
r10980 r11068 25 25 using System.Text; 26 26 using HeuristicLab.Data; 27 using HeuristicLab.Problems.DataAnalysis .Transformations;27 using HeuristicLab.Problems.DataAnalysis; 28 28 29 29 namespace HeuristicLab.DataPreprocessing { … … 64 64 renamedColumns.Clear(); 65 65 } 66 } finally { 66 } 67 finally { 67 68 preprocessingData.EndTransaction(); 68 69 } … … 71 72 } 72 73 73 private void PreserveColumns(I List<Transformation<double>> transformations) {74 private void PreserveColumns(IEnumerable<Transformation<double>> transformations) { 74 75 foreach (var transformation in transformations) { 75 76 if (!originalColumns.ContainsKey(transformation.Column)) { … … 81 82 } 82 83 83 private void ApplyDoubleTranformationsInplace(I List<Transformation<double>> transformations, bool preserveColumns, out bool success, out string errorMsg) {84 private void ApplyDoubleTranformationsInplace(IEnumerable<Transformation<double>> transformations, bool preserveColumns, out bool success, out string errorMsg) { 84 85 errorMsg = string.Empty; 85 86 success = true; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r10990 r11068 24 24 using HeuristicLab.Common; 25 25 using HeuristicLab.Problems.DataAnalysis; 26 using HeuristicLab.Problems.DataAnalysis.Transformations;27 26 28 27 namespace HeuristicLab.DataPreprocessing {
Note: See TracChangeset
for help on using the changeset viewer.