Changeset 10694 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/Transformations/LinearTransformation.cs
- Timestamp:
- 04/02/14 11:23:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/Transformations/LinearTransformation.cs
r10671 r10694 20 20 #endregion 21 21 22 23 using System.Collections.Generic; 22 24 using System.Linq; 25 using HeuristicLab.Common; 23 26 using HeuristicLab.Core; 24 27 using HeuristicLab.Data; 25 28 using HeuristicLab.DataPreprocessing.Transformations; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;27 29 using HeuristicLab.Parameters; 28 29 30 namespace HeuristicLab.DataPreprocessing.Implementations.Transformations { 30 31 [Item("LinearTransformation", "Represents a linear transformation with multiplication and addition.")] 31 public class LinearTransformation : Transformation {32 public class LinearTransformation : Transformation<double> { 32 33 33 34 #region Parameters … … 46 47 } 47 48 48 public override void Transform() { 49 PreprocessingData.InTransaction(() => { 50 int idx = PreprocessingData.GetColumnIndex(Column); 51 if (PreprocessingData.IsType<double>(idx)) { 52 var column = PreprocessingData.GetValues<double>(idx); 53 var transformedColumn = column.Select(e => e * MultiplicandParameter.Value.Value + SummandParameter.Value.Value).ToList(); 54 PreprocessingData.SetValues<double>(idx, transformedColumn); 55 } 56 }, 57 DataPreprocessingChangedEventType.Transformation); 49 public override IEnumerable<double> Apply(IEnumerable<double> data) { 50 return data.Select(e => e * MultiplicandParameter.Value.Value + SummandParameter.Value.Value).ToList(); 58 51 } 59 52 60 public override I SymbolicExpressionTree GenerateInverseTransformation() {53 public override IEnumerable<double> InverseApply(IEnumerable<double> data) { 61 54 throw new System.NotImplementedException(); 62 55 } 63 56 64 public override void Check() {57 public override IDeepCloneable Clone(Cloner cloner) { 65 58 throw new System.NotImplementedException(); 66 59 } 67 60 68 public override Common.IDeepCloneable Clone(Common.Cloner cloner) {61 public override void Check(IEnumerable<double> data) { 69 62 throw new System.NotImplementedException(); 70 63 }
Note: See TracChangeset
for help on using the changeset viewer.