Changeset 9145


Ignore:
Timestamp:
01/11/13 13:03:54 (8 years ago)
Author:
mkommend
Message:

#1837: Improved Sliding Window Analyzers to work with user defined algorithms.

Location:
branches/Sliding Window GP
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/GenerationalSlidingWindowAnalyzer.cs

    r7850 r9145  
    7474      Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalParameterName, "", new IntValue(5)));
    7575      Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalStartParameterName, "", new IntValue(0)));
    76 
    77       GenerationsIntervalStartParameter.Hidden = true;
    7876    }
    7977
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs

    r7850 r9145  
    3838    private const string SlidingWindowSizeParameterName = "Sliding Window Size";
    3939    private const string SlidingWindowStepWidthParameterName = "Sliding Window Step Width";
     40    private const string InitialSlidingWindowParameterName = "Initial Sliding Window";
    4041
    4142    private const string SlidingWindowDataResultName = "Sliding Window";
     
    5859      get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowStepWidthParameterName]; }
    5960    }
     61    public IFixedValueParameter<IntRange> InitialSlidingWindowParameter {
     62      get {
     63        return (IFixedValueParameter<IntRange>)Parameters[InitialSlidingWindowParameterName];
     64      }
     65    }
    6066    #endregion
    6167
     
    6470    public IntValue SlidingWindowSize { get { return SlidingWindowSizeParameter.Value; } }
    6571    public IntValue SlidingWindowStepWidth { get { return SlidingWindowStepWidthParameter.Value; } }
     72    public IntRange InitialSlidingWindow { get { return InitialSlidingWindowParameter.Value; } }
    6673    #endregion
    6774
     
    7885      Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowSizeParameterName, "", new IntValue(1)));
    7986      Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowStepWidthParameterName, "", new IntValue(1)));
     87      Parameters.Add(new FixedValueParameter<IntRange>(InitialSlidingWindowParameterName, "", new IntRange(0, 1)));
     88
     89      FitnessCalculationPartitionParameter.ActualName = "Sliding Window";
    8090    }
    8191
    8292    public override IOperation Apply() {
    83       if (CheckForUpdate()) {
     93      if (FitnessCalculationPartitionParameter.ActualValue == null) {
     94        FitnessCalculationPartitionParameter.ActualValue = (IntRange)InitialSlidingWindow.Clone();
     95      } else if (CheckForUpdate()) {
    8496        var fitnessPartition = FitnessCalculationPartitionParameter.ActualValue;
    8597        if (fitnessPartition.End - fitnessPartition.Start == SlidingWindowSize.Value)
     
    89101        if (fitnessPartition.End - fitnessPartition.Start > SlidingWindowSize.Value)
    90102          fitnessPartition.End = fitnessPartition.Start + SlidingWindowSize.Value;
     103
     104        //TODO check if fitnesspartition exceeds training partition
    91105      }
    92106
     
    109123      slidingWindowData.SlidingWindowPosition.Start = FitnessCalculationPartitionParameter.ActualValue.Start;
    110124      slidingWindowData.SlidingWindowPosition.End = FitnessCalculationPartitionParameter.ActualValue.End;
     125
    111126      return base.Apply();
    112127    }
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs

    r9126 r9145  
    231231      Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer());
    232232      Operators.Add(new SymbolicExpressionTreeLengthAnalyzer());
    233       Operators.Add(new GenerationalSlidingWindowAnalyzer<T>());
    234233      ParameterizeOperators();
    235234    }
     
    351350        op.EvaluatorParameter.ActualName = EvaluatorParameter.Name;
    352351      }
    353 
    354       foreach (var op in operators.OfType<SlidingWindowAnalyzer<T>>()) {
    355         op.FitnessCalculationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name;
    356         op.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
    357 
    358         var start = ProblemData.TrainingPartition.Start;
    359         var end = ProblemData.TrainingPartition.End;
    360         var size = (end - start) / 5;
    361         op.SlidingWindowSize.Value = size;
    362         op.SlidingWindowStepWidth.Value = size / 2;
    363       }
    364352    }
    365353
Note: See TracChangeset for help on using the changeset viewer.