- Timestamp:
- 04/23/14 14:10:06 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3/LinearTransformation.cs
r10775 r10777 34 34 [Item("LinearTransformation", "Represents a linear transformation with multiplication and addition.")] 35 35 public class LinearTransformation : Transformation<double> { 36 protected const string Multipli candParameterName = "Multiplicand";37 protected const string SummandParameterName = "Summand";36 protected const string MultiplierParameterName = "Multiplier"; 37 protected const string AddendParameterName = "Addend"; 38 38 39 39 #region Parameters 40 public IValueParameter<DoubleValue> Multipli candParameter {41 get { return (IValueParameter<DoubleValue>)Parameters[Multipli candParameterName]; }40 public IValueParameter<DoubleValue> MultiplierParameter { 41 get { return (IValueParameter<DoubleValue>)Parameters[MultiplierParameterName]; } 42 42 } 43 public IValueParameter<DoubleValue> SummandParameter {44 get { return (IValueParameter<DoubleValue>)Parameters[ SummandParameterName]; }43 public IValueParameter<DoubleValue> AddendParameter { 44 get { return (IValueParameter<DoubleValue>)Parameters[AddendParameterName]; } 45 45 } 46 46 #endregion 47 47 48 48 #region properties 49 public double Multipli cand{50 get { return Multipli candParameter.Value.Value; }49 public double Multiplier { 50 get { return MultiplierParameter.Value.Value; } 51 51 protected set { 52 Multipli candParameter.Value.Value = value;52 MultiplierParameter.Value.Value = value; 53 53 } 54 54 } 55 55 56 public double Summand {57 get { return SummandParameter.Value.Value; }56 public double Addend { 57 get { return AddendParameter.Value.Value; } 58 58 protected set { 59 SummandParameter.Value.Value = value;59 AddendParameter.Value.Value = value; 60 60 } 61 61 } … … 71 71 public LinearTransformation(IEnumerable<string> allowedColumns) 72 72 : base(allowedColumns) { 73 Parameters.Add(new ValueParameter<DoubleValue>(Multipli candParameterName, "Multiplicandfor linear transformation", new DoubleValue(1.0)));74 Parameters.Add(new ValueParameter<DoubleValue>( SummandParameterName, "Summand for linear transformation", new DoubleValue(0.0)));73 Parameters.Add(new ValueParameter<DoubleValue>(MultiplierParameterName, "Multiplier for linear transformation", new DoubleValue(1.0))); 74 Parameters.Add(new ValueParameter<DoubleValue>(AddendParameterName, "Addend for linear transformation", new DoubleValue(0.0))); 75 75 } 76 76 … … 80 80 81 81 public override IEnumerable<double> Apply(IEnumerable<double> data) { 82 return data.Select(e => e * Multipli cand + Summand);82 return data.Select(e => e * Multiplier + Addend); 83 83 } 84 84 … … 88 88 errorMsg = null; 89 89 90 if (Multipli cand== 0.0) {91 sb.Append(String.Format("Multiplicand is 0, all {0} entries will be set to {1}. Reversal will not be possble", data.Count(), Summand));90 if (Multiplier == 0.0) { 91 sb.Append(String.Format("Multiplicand is 0, all {0} entries will be set to {1}. Reversal will not be possble", data.Count(), Addend)); 92 92 errorMsg = sb.ToString(); 93 93 success = false; -
branches/DataPreprocessing/HeuristicLab.Problems.DataAnalysis.Transformations/3.3/ShiftDataToRangeTransformation.cs
r10775 r10777 34 34 public ShiftDataToRangeTransformation(IEnumerable<string> allowedColumns) 35 35 : base(allowedColumns) { 36 Multipli candParameter.Hidden = true;37 SummandParameter.Hidden = true;36 MultiplierParameter.Hidden = true; 37 AddendParameter.Hidden = true; 38 38 Parameters.Add(new ValueParameter<DoubleRange>(RangeParameterName, "Range for the target window of the linear transformation", new DoubleRange(0.0, 1.0))); 39 39 } … … 60 60 double targetRangeWidth = Range.End - Range.Start; 61 61 62 Multipli cand= targetRangeWidth / originalRangeWidth;63 Summand = Range.Start - originalRangeStart * Multiplicand;62 Multiplier = targetRangeWidth / originalRangeWidth; 63 Addend = Range.Start - originalRangeStart * Multiplier; 64 64 } 65 65 }
Note: See TracChangeset
for help on using the changeset viewer.