Changeset 1480
- Timestamp:
- 04/02/09 13:46:28 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP/TrainingWindowSlider.cs
r1477 r1480 46 46 AddVariableInfo(new VariableInfo(TRAINING_WINDOW_START, "Start of training set window", typeof(IntData), VariableKind.In | VariableKind.Out)); 47 47 AddVariableInfo(new VariableInfo(TRAINING_WINDOW_END, "End of training set window", typeof(IntData), VariableKind.In | VariableKind.Out)); 48 AddVariableInfo(new VariableInfo(STEP_SIZE, "Num er 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)); 49 49 } 50 50 … … 52 52 int trainingSamplesStart = GetVariableValue<IntData>(TRAINING_SAMPLES_START, scope, true).Data; 53 53 int trainingSamplesEnd = GetVariableValue<IntData>(TRAINING_SAMPLES_END, scope, true).Data; 54 int wholeTrainingSetSize = trainingSamplesEnd - trainingSamplesStart;55 56 54 int trainingWindowStart = GetVariableValue<IntData>(TRAINING_WINDOW_START, scope, true).Data; 57 55 int trainingWindowEnd = GetVariableValue<IntData>(TRAINING_WINDOW_END, scope, true).Data; 58 56 int stepSize = GetVariableValue<IntData>(STEP_SIZE, scope, true).Data; 59 int windowSize = trainingWindowEnd - trainingWindowStart;60 57 61 int trainingWindowEndOffset = trainingWindowEnd - trainingSamplesStart; 62 trainingWindowEndOffset = (trainingWindowEndOffset + stepSize) % wholeTrainingSetSize; 63 trainingWindowEnd = trainingWindowEndOffset + trainingSamplesStart; 64 65 if (trainingWindowEnd > trainingWindowStart) { 58 if (trainingWindowEnd + stepSize <= trainingSamplesEnd) { 66 59 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; 71 61 } 72 62
Note: See TracChangeset
for help on using the changeset viewer.