Changeset 15879 for branches/2906_Transformations
- Timestamp:
- 03/30/18 15:46:05 (7 years ago)
- Location:
- branches/2906_Transformations
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2906_Transformations/HeuristicLab.DataPreprocessing.Views/3.4/TransformationListView.cs
r15865 r15879 105 105 106 106 // TODO: do not move/remove already applied transformations 107 // TODO: general disal ow of movement?107 // TODO: general disallow of movement? 108 108 if (Content[selectedIndex].IsApplied) { 109 109 moveUpButton.Enabled = selectedIndex > 0 && Content[selectedIndex - 1].IsApplied; -
branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r15870 r15879 245 245 var newDataset = DataAnalysisTransformationModel.Transform(Dataset, Transformations); 246 246 247 var extendedInputs = ExtendInputVariables(AllowedInputVariables, Transformations);247 var extendedInputs = DataAnalysisTransformationModel.ExtendInputVariables(AllowedInputVariables, Transformations); 248 248 var checkedInputs = new CheckedItemList<StringValue>(newDataset.VariableNames.Select(x => new StringValue(x))); 249 249 foreach (var input in checkedInputs) checkedInputs.SetItemCheckedState(input, extendedInputs.Contains(input.Value)); … … 297 297 return modifiableDataset; 298 298 } 299 300 public static IEnumerable<string> ExtendInputVariables(IEnumerable<string> oldInputVariables, IEnumerable<IDataAnalysisTransformation> transformations) {301 var inputs = new HashSet<string>(oldInputVariables);302 303 foreach (var transformation in transformations) {304 if (inputs.Contains(transformation.OriginalVariable))305 inputs.Add(transformation.TransformedVariable);306 }307 308 return inputs;309 }310 311 public static IEnumerable<string> RemoveVirtualVariables(IEnumerable<string> variables, IEnumerable<IDataAnalysisTransformation> transformations) {312 var remainingVariables = new HashSet<string>(variables);313 314 var transformationsStack = new Stack<IDataAnalysisTransformation>(transformations);315 316 while (transformationsStack.Any()) {317 var transformation = transformationsStack.Pop();318 319 320 bool transformedVariablePending = transformationsStack.Any(x => x.OriginalVariable == transformation.TransformedVariable);321 if (!transformedVariablePending)322 remainingVariables.Remove(transformation.TransformedVariable);323 }324 325 return remainingVariables;326 }327 299 } 328 300 } -
branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisTransformation.cs
r15870 r15879 29 29 [Item("Transformation", "A transformation applied to a DataAnalysisProblemData")] 30 30 [StorableClass] 31 public class DataAnalysisTransformation : ParameterizedNamedItem, IDataAnalysisTransformation {31 public sealed class DataAnalysisTransformation : ParameterizedNamedItem, IDataAnalysisTransformation { 32 32 #region Parameter Properties 33 33 private IFixedValueParameter<StringValue> OriginalVariableParameter { … … 66 66 } 67 67 68 pr otectedDataAnalysisTransformation(DataAnalysisTransformation original, Cloner cloner)68 private DataAnalysisTransformation(DataAnalysisTransformation original, Cloner cloner) 69 69 : base(original, cloner) { 70 70 } … … 75 75 76 76 [StorableConstructor] 77 pr otectedDataAnalysisTransformation(bool deserializing)77 private DataAnalysisTransformation(bool deserializing) 78 78 : base(deserializing) { } 79 79 -
branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/ITransformation.cs
r15846 r15879 28 28 29 29 public interface ITransformation<T> : ITransformation { 30 /// <summary> 31 /// Checks if the data is valid for the transformation. 32 /// Calling <code>Apply</code> or <code>Configure</code> on invalid data will throw an exception. 33 /// </summary> 34 /// <param name="data"></param> 35 /// <param name="errorMessage"></param> 36 /// <returns></returns> 30 37 bool Check(IEnumerable<T> data, out string errorMessage); 31 38 39 /// <summary> 40 /// Configure the internal parameter of the transformation for the given data. 41 /// </summary> 42 /// <param name="data"></param> 32 43 void Configure(IEnumerable<T> data); 33 44 45 /// <summary> 46 /// Transforms the given data based on the transformation's external and internal parameters. 47 /// </summary> 48 /// <param name="data"></param> 49 /// <returns></returns> 34 50 IEnumerable<T> Apply(IEnumerable<T> data); 51 /// <summary> 52 /// Inverse-transforms the given data based on the transformation's external and internal parameters. 53 /// </summary> 54 /// <param name="data"></param> 55 /// <returns></returns> 56 /// <remarks>If the data cannot be inverse transformed, i.e. if the original data was not in the domain of the transformation, 57 /// the returned values can contain invalid values or <code>InverseApply</code> might throw an exception.</remarks> 35 58 IEnumerable<T> InverseApply(IEnumerable<T> data); 36 59 }
Note: See TracChangeset
for help on using the changeset viewer.