Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/14 11:23:44 (10 years ago)
Author:
tsteinre
Message:
  • LinearTransformation and Transformation now uses ITransformation,
  • refactoring
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/Transformations/LinearTransformation.cs

    r10671 r10694  
    2020#endregion
    2121
     22
     23using System.Collections.Generic;
    2224using System.Linq;
     25using HeuristicLab.Common;
    2326using HeuristicLab.Core;
    2427using HeuristicLab.Data;
    2528using HeuristicLab.DataPreprocessing.Transformations;
    26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2729using HeuristicLab.Parameters;
    28 
    2930namespace HeuristicLab.DataPreprocessing.Implementations.Transformations {
    3031  [Item("LinearTransformation", "Represents a linear transformation with multiplication and addition.")]
    31   public class LinearTransformation : Transformation {
     32  public class LinearTransformation : Transformation<double> {
    3233
    3334    #region Parameters
     
    4647    }
    4748
    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();
    5851    }
    5952
    60     public override ISymbolicExpressionTree GenerateInverseTransformation() {
     53    public override IEnumerable<double> InverseApply(IEnumerable<double> data) {
    6154      throw new System.NotImplementedException();
    6255    }
    6356
    64     public override void Check() {
     57    public override IDeepCloneable Clone(Cloner cloner) {
    6558      throw new System.NotImplementedException();
    6659    }
    6760
    68     public override Common.IDeepCloneable Clone(Common.Cloner cloner) {
     61    public override void Check(IEnumerable<double> data) {
    6962      throw new System.NotImplementedException();
    7063    }
Note: See TracChangeset for help on using the changeset viewer.