Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/18 15:46:12 (6 years ago)
Author:
pfleck
Message:

#2906 Added PreprocessingTransformation as a custom view-model for transformations in preprocessing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2906_Transformations/HeuristicLab.DataPreprocessing/3.4/Data/PreprocessingData.cs

    r15846 r15865  
    4747      Name = "Preprocessing Data";
    4848
    49       Transformations = new List<IDataAnalysisTransformation>();
     49      Transformations = new List<PreprocessingTransformation>();
    5050      selection = new Dictionary<int, IList<int>>();
    5151
     
    6161      TrainingPartition = (IntRange)original.TrainingPartition.Clone(cloner);
    6262      TestPartition = (IntRange)original.TestPartition.Clone(cloner);
    63       Transformations = new List<IDataAnalysisTransformation>(original.Transformations.Select(cloner.Clone));
     63      Transformations = new List<PreprocessingTransformation>(original.Transformations.Select(cloner.Clone));
    6464
    6565      InputVariables = new List<string>(original.InputVariables);
     
    350350    #region Transformations
    351351    [Storable]
    352     public IList<IDataAnalysisTransformation> Transformations { get; protected set; }
     352    public IList<PreprocessingTransformation> Transformations { get; protected set; }
    353353    #endregion
    354354
     
    414414      }
    415415
     416      // TODO: set fixed constrained (allowed) values
     417      foreach (var trans in problemData.Transformations) {
     418        var newTrans = new PreprocessingTransformation(variableNames.Select(x => new StringValue(x))) {
     419          OriginalVariable = trans.OriginalVariable,
     420          TransformedVariable = trans.TransformedVariable,
     421          IsApplied = true
     422        };
     423        var cloned = (ITransformation)trans.Transformation.Clone();
     424        newTrans.TransformationParameter.ValidValues.Add(cloned);
     425        newTrans.Transformation = cloned;
     426        Transformations.Add(newTrans);
     427      }
     428
    416429      TrainingPartition = new IntRange(problemData.TrainingPartition.Start, problemData.TrainingPartition.End);
    417430      TestPartition = new IntRange(problemData.TestPartition.Start, problemData.TestPartition.End);
     
    459472      public IntRange TrainingPartition { get; set; }
    460473      public IntRange TestPartition { get; set; }
    461       public IList<IDataAnalysisTransformation> Transformations { get; set; }
     474      public IList<PreprocessingTransformation> Transformations { get; set; }
    462475      public DataPreprocessingChangedEventType ChangedType { get; set; }
    463476
     
    487500        TrainingPartition = new IntRange(TrainingPartition.Start, TrainingPartition.End),
    488501        TestPartition = new IntRange(TestPartition.Start, TestPartition.End),
    489         Transformations = new List<IDataAnalysisTransformation>(Transformations),
     502        Transformations = new List<PreprocessingTransformation>(Transformations),
    490503        ChangedType = changedType,
    491504        ChangedColumn = column,
     
    682695      l = 0;
    683696      ir = n - 1;
    684       for (;;) {
     697      for (; ; ) {
    685698        if (ir <= l + 1) {
    686699          // Active partition contains 1 or 2 elements.
     
    707720          j = ir;
    708721          a = arr[l + 1]; // Partitioning element.
    709           for (;;) { // Beginning of innermost loop.
     722          for (; ; ) { // Beginning of innermost loop.
    710723            do i++; while (arr[i].CompareTo(a) < 0); // Scan up to find element > a.
    711724            do j--; while (arr[j].CompareTo(a) > 0); // Scan down to find element < a.
Note: See TracChangeset for help on using the changeset viewer.