- Timestamp:
- 07/16/13 13:51:27 (11 years ago)
- Location:
- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs
r9164 r9707 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Operators; 26 using HeuristicLab.Optimization; 25 27 using HeuristicLab.Parameters; 26 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 31 33 public abstract class SlidingWindowAnalyzer : SymbolicDataAnalysisAnalyzer { 32 34 private const string ProblemDataParameterName = "ProblemData"; 35 private const string EvaluatorParameterName = "Evaluator"; 33 36 private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition"; 34 37 private const string ValidationPartitionParameterName = "ValidationPartition"; … … 64 67 get { return (ILookupParameter<BoolValue>)Parameters[TerminateSlidingWindowParameterName]; } 65 68 } 69 public ILookupParameter<IEvaluator> EvaluatorParameter { 70 get { return (ILookupParameter<IEvaluator>)Parameters[EvaluatorParameterName]; } 71 } 66 72 #endregion 67 73 … … 83 89 : base() { 84 90 Parameters.Add(new ValueLookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated.")); 91 Parameters.Add(new LookupParameter<IEvaluator>(EvaluatorParameterName, "")); 85 92 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "")); 86 93 Parameters.Add(new LookupParameter<IntRange>(ValidationPartitionParameterName, "")); … … 92 99 93 100 ProblemDataParameter.Hidden = true; 101 } 102 103 [StorableHook(HookType.AfterDeserialization)] 104 private void AfterDeserialization() { 105 if (!Parameters.ContainsKey(EvaluatorParameterName)) 106 Parameters.Add(new LookupParameter<IEvaluator>(EvaluatorParameterName, "")); 94 107 } 95 108 … … 115 128 116 129 //check if update should be performed or if the algorithm should stop 117 if (fitnessPartition.End > ProblemDataParameter.ActualValue.TrainingPartition.End) 130 if (fitnessPartition.End > ProblemDataParameter.ActualValue.TrainingPartition.End) { 118 131 TerminateSlidingWindowParameter.ActualValue.Value = true; 119 else { 120 FitnessCalculationPartitionParameter.ActualValue.Start = fitnessPartition.Start; 121 FitnessCalculationPartitionParameter.ActualValue.End = fitnessPartition.End; 122 ValidationPartitionParameter.ActualValue.Start = fitnessPartition.End; 123 ValidationPartitionParameter.ActualValue.End = ValidationPartitionParameter.ActualValue.Start + ValidiationSlidingWindowSize.Value; 132 return base.Apply(); 124 133 } 125 134 126 return base.Apply(); 135 FitnessCalculationPartitionParameter.ActualValue.Start = fitnessPartition.Start; 136 FitnessCalculationPartitionParameter.ActualValue.End = fitnessPartition.End; 137 ValidationPartitionParameter.ActualValue.Start = fitnessPartition.End; 138 ValidationPartitionParameter.ActualValue.End = ValidationPartitionParameter.ActualValue.Start + ValidiationSlidingWindowSize.Value; 139 140 //reevaluate all individuals with new sliding window 141 UniformSubScopesProcessor subScopesProcessor = new UniformSubScopesProcessor(); 142 subScopesProcessor.Operator = EvaluatorParameter.ActualValue; 143 subScopesProcessor.Depth.Value = 1; 144 var operation = ExecutionContext.CreateChildOperation(subScopesProcessor); 145 var successor = base.Apply(); 146 return new OperationCollection() { operation, successor }; 127 147 } 128 148 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowVisualizer.cs
r9162 r9707 85 85 else throw new NotSupportedException(); 86 86 87 var targetData = ProblemDataParameter.ActualValue.Dataset.GetDoubleValues(targetVariable );87 var targetData = ProblemDataParameter.ActualValue.Dataset.GetDoubleValues(targetVariable, ProblemDataParameter.ActualValue.TrainingIndices); 88 88 slidingWindowData = new SlidingWindowData(FitnessCalculationPartitionParameter.ActualValue, targetData); 89 89 results.Add(new Result(SlidingWindowDataResultName, slidingWindowData)); … … 96 96 var classificationSolution = trainingSolution as IClassificationSolution; 97 97 98 if (regressionSolution != null) estimatedValues = regressionSolution.Estimated Values;99 if (classificationSolution != null) estimatedValues = classificationSolution.Estimated ClassValues;98 if (regressionSolution != null) estimatedValues = regressionSolution.EstimatedTrainingValues; 99 if (classificationSolution != null) estimatedValues = classificationSolution.EstimatedTrainingClassValues; 100 100 } 101 101
Note: See TracChangeset
for help on using the changeset viewer.