- Timestamp:
- 05/07/14 11:04:44 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3/HeuristicLab.Problems.DataAnalysis.Transformations-3.3.csproj
r10784 r10805 49 49 <Compile Include="CopyColumnTransformation.cs" /> 50 50 <Compile Include="DeviationTransformation.cs" /> 51 <Compile Include=" ExponentiationTransformation.cs" />51 <Compile Include="PowerTransformation.cs" /> 52 52 <Compile Include="ExponentialTransformation.cs" /> 53 53 <Compile Include="LogarithmicTransformation.cs" /> -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3/PowerTransformation.cs
r10804 r10805 8 8 9 9 namespace HeuristicLab.Problems.DataAnalysis.Transformations { 10 [Item(" ExponentationTransformation", "Represents a exponentationtransformation.")]11 public class ExponentiationTransformation : Transformation<double> {12 protected const string BaseParameterName = "Base";10 [Item("PowerTransformation", "Represents a power transformation.")] 11 public class PowerTransformation : Transformation<double> { 12 protected const string ExponentParameterName = "Exponent"; 13 13 14 14 #region Parameters 15 public IValueParameter<DoubleValue> BaseParameter {16 get { return (IValueParameter<DoubleValue>)Parameters[ BaseParameterName]; }15 public IValueParameter<DoubleValue> ExponentParameter { 16 get { return (IValueParameter<DoubleValue>)Parameters[ExponentParameterName]; } 17 17 } 18 18 #endregion 19 19 20 20 #region properties 21 public double Base{22 get { return BaseParameter.Value.Value; }21 public double Exponent { 22 get { return ExponentParameter.Value.Value; } 23 23 } 24 24 #endregion 25 25 26 26 [StorableConstructor] 27 protected ExponentiationTransformation(bool deserializing) : base(deserializing) { }28 protected ExponentiationTransformation(Transformation<double> original, Cloner cloner)27 protected PowerTransformation(bool deserializing) : base(deserializing) { } 28 protected PowerTransformation(Transformation<double> original, Cloner cloner) 29 29 : base(original, cloner) { 30 30 } 31 public ExponentiationTransformation(IEnumerable<string> allowedColumns)31 public PowerTransformation(IEnumerable<string> allowedColumns) 32 32 : base(allowedColumns) { 33 Parameters.Add(new ValueParameter<DoubleValue>(BaseParameterName, "Basefor Exponentation", new DoubleValue(Math.E)));33 Parameters.Add(new ValueParameter<DoubleValue>(ExponentParameterName, "Exponent for Exponentation", new DoubleValue(Math.E))); 34 34 } 35 35 36 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new ExponentiationTransformation(this, cloner);37 return new PowerTransformation(this, cloner); 38 38 } 39 39 40 40 public override IEnumerable<double> Apply(IEnumerable<double> data) { 41 41 foreach (double i in data) { 42 yield return Math.Pow( Base, i);42 yield return Math.Pow(i, Exponent); 43 43 } 44 44 }
Note: See TracChangeset
for help on using the changeset viewer.