Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1480


Ignore:
Timestamp:
04/02/09 13:46:28 (16 years ago)
Author:
gkronber
Message:

Changed sliding window approach to stop at the last window. #564 (Sliding window approach for data-based modeling)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.GP/TrainingWindowSlider.cs

    r1477 r1480  
    4646      AddVariableInfo(new VariableInfo(TRAINING_WINDOW_START, "Start of training set window", typeof(IntData), VariableKind.In | VariableKind.Out));
    4747      AddVariableInfo(new VariableInfo(TRAINING_WINDOW_END, "End of training set window", typeof(IntData), VariableKind.In | VariableKind.Out));
    48       AddVariableInfo(new VariableInfo(STEP_SIZE, "Numer of samples to slide the window forward", typeof(IntData), VariableKind.In));
     48      AddVariableInfo(new VariableInfo(STEP_SIZE, "Number of samples to slide the window forward", typeof(IntData), VariableKind.In));
    4949    }
    5050
     
    5252      int trainingSamplesStart = GetVariableValue<IntData>(TRAINING_SAMPLES_START, scope, true).Data;
    5353      int trainingSamplesEnd = GetVariableValue<IntData>(TRAINING_SAMPLES_END, scope, true).Data;
    54       int wholeTrainingSetSize = trainingSamplesEnd - trainingSamplesStart;
    55 
    5654      int trainingWindowStart = GetVariableValue<IntData>(TRAINING_WINDOW_START, scope, true).Data;
    5755      int trainingWindowEnd = GetVariableValue<IntData>(TRAINING_WINDOW_END, scope, true).Data;
    5856      int stepSize = GetVariableValue<IntData>(STEP_SIZE, scope, true).Data;
    59       int windowSize = trainingWindowEnd - trainingWindowStart;
    6057
    61       int trainingWindowEndOffset = trainingWindowEnd - trainingSamplesStart;
    62       trainingWindowEndOffset = (trainingWindowEndOffset + stepSize) % wholeTrainingSetSize;
    63       trainingWindowEnd = trainingWindowEndOffset + trainingSamplesStart;
    64      
    65       if (trainingWindowEnd > trainingWindowStart) {
     58      if (trainingWindowEnd + stepSize <= trainingSamplesEnd) {
    6659        trainingWindowStart = trainingWindowStart + stepSize;
    67       } else {
    68         // slide over end of whole training set => reset to beginning
    69         trainingWindowStart = trainingSamplesStart;
    70         trainingWindowEnd = trainingWindowStart + windowSize;
     60        trainingWindowEnd = trainingWindowEnd + stepSize;
    7161      }
    7262
Note: See TracChangeset for help on using the changeset viewer.