Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/15 15:58:16 (9 years ago)
Author:
gkronber
Message:

#2415: added StorableClass attribute to transformation functions (+code improvements)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/LogarithmicTransformation.cs

    r11114 r12612  
    99
    1010namespace HeuristicLab.Problems.DataAnalysis {
     11  [StorableClass]
    1112  [Item("Logarithmic Transformation", "f(x) = log(x, b) | Represents a logarithmic transformation.")]
    1213  public class LogarithmicTransformation : Transformation<double> {
     
    4344
    4445    public override IEnumerable<double> Apply(IEnumerable<double> data) {
    45       foreach (double i in data) {
    46         if (i > 0.0)
    47           yield return Math.Log(i, Base);
    48         else
    49           yield return i;
    50       }
     46      var b = Base;
     47      return data.Select(d => d > 0.0 ? Math.Log(d, b) : d);
    5148    }
    5249
Note: See TracChangeset for help on using the changeset viewer.