- Timestamp:
- 09/07/09 19:08:18 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/HeuristicLab.GP.StructureIdentification.TimeSeries-3.3.csproj
r2222 r2341 83 83 <ItemGroup> 84 84 <Compile Include="AveragePercentageChangeEvaluator.cs" /> 85 <Compile Include="DefaultTimeSeriesOperators.cs" /> 85 86 <Compile Include="HeuristicLabGPTimeSeriesPlugin.cs" /> 86 87 <Compile Include="OffspringSelectionGP.cs" /> … … 102 103 <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project> 103 104 <Name>HeuristicLab.Data-3.2</Name> 105 </ProjectReference> 106 <ProjectReference Include="..\..\HeuristicLab.GP.Algorithms\3.2\HeuristicLab.GP.Algorithms-3.2.csproj"> 107 <Project>{3127719F-110E-4558-8845-98559DBB422D}</Project> 108 <Name>HeuristicLab.GP.Algorithms-3.2</Name> 104 109 </ProjectReference> 105 110 <ProjectReference Include="..\..\HeuristicLab.GP.Interfaces\3.3\HeuristicLab.GP.Interfaces-3.3.csproj"> -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/OffspringSelectionGP.cs
r2319 r2341 23 23 using HeuristicLab.Modeling; 24 24 using HeuristicLab.Operators; 25 using System; 26 using HeuristicLab.Data; 27 using HeuristicLab.GP.Algorithms; 25 28 26 29 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { 27 30 public class OffspringSelectionGP : HeuristicLab.GP.StructureIdentification.OffspringSelectionGP, ITimeSeriesAlgorithm { 28 public override IOperator ProblemInjector { 29 get { 30 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 31 return algo.OperatorGraph.InitialOperator.SubOperators[1]; 32 } 33 set { 34 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 35 algo.OperatorGraph.InitialOperator.RemoveSubOperator(1); 36 value.Name = "ProblemInjector"; 37 algo.OperatorGraph.InitialOperator.AddSubOperator(value, 1); 38 } 31 32 public int MinTimeOffset { 33 get { return GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data; } 34 set { GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data = value; } 35 } 36 37 public int MaxTimeOffset { 38 get { return GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data; } 39 set { GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data = value; } 40 } 41 42 public bool UseEstimatedTargetValue { 43 get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; } 44 set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; } 45 } 46 47 protected override IOperator CreateProblemInjector() { 48 return DefaultTimeSeriesOperators.CreateProblemInjector(); 39 49 } 40 50 41 51 protected override IOperator CreateFunctionLibraryInjector() { 42 return newFunctionLibraryInjector();52 return DefaultTimeSeriesOperators.CreateFunctionLibraryInjector(); 43 53 } 44 54 45 protected override IOperator CreateP roblemInjector() {46 return new ProblemInjector();55 protected override IOperator CreatePostProcessingOperator() { 56 return DefaultTimeSeriesOperators.CreatePostProcessingOperator(); 47 57 } 48 58 49 protected override IOperator CreateBestSolutionProcessor() { 50 SequentialProcessor seq = new SequentialProcessor(); 51 seq.AddSubOperator(base.CreateBestSolutionProcessor()); 52 seq.AddSubOperator(StandardGP.BestSolutionProcessor); 53 return seq; 59 protected override VariableInjector CreateGlobalInjector() { 60 VariableInjector injector = base.CreateGlobalInjector(); 61 injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData())); 62 injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData())); 63 injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData())); 64 return injector; 54 65 } 55 66 56 public override IEditor CreateEditor() {57 return new OffspringSelectionGpEditor(this);58 }59 60 public override IView CreateView() {61 return new OffspringSelectionGpEditor(this);62 }63 67 } 64 68 } -
trunk/sources/HeuristicLab.GP.StructureIdentification.TimeSeries/3.3/StandardGP.cs
r2319 r2341 25 25 using HeuristicLab.Modeling; 26 26 using HeuristicLab.Operators; 27 using System; 27 28 28 29 namespace HeuristicLab.GP.StructureIdentification.TimeSeries { 29 30 public class StandardGP : HeuristicLab.GP.StructureIdentification.StandardGP, ITimeSeriesAlgorithm { 30 public override IOperator ProblemInjector { 31 get { 32 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 33 return algo.OperatorGraph.InitialOperator.SubOperators[1]; 34 } 35 set { 36 CombinedOperator algo = (CombinedOperator)Engine.OperatorGraph.InitialOperator; 37 algo.OperatorGraph.InitialOperator.RemoveSubOperator(1); 38 value.Name = "ProblemInjector"; 39 algo.OperatorGraph.InitialOperator.AddSubOperator(value, 1); 40 } 31 public int MinTimeOffset { 32 get { return GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data; } 33 set { GetVariableInjector().GetVariable("MinTimeOffset").GetValue<IntData>().Data = value; } 41 34 } 42 43 protected override IOperator CreateFunctionLibraryInjector() { 44 return new FunctionLibraryInjector(); 35 36 public int MaxTimeOffset { 37 get { return GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data; } 38 set { GetVariableInjector().GetVariable("MaxTimeOffset").GetValue<IntData>().Data = value; } 39 } 40 41 public bool UseEstimatedTargetValue { 42 get { return GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data; } 43 set { GetVariableInjector().GetVariable("UseEstimatedTargetValue").GetValue<BoolData>().Data = value; } 45 44 } 46 45 47 46 protected override IOperator CreateProblemInjector() { 48 return newProblemInjector();47 return DefaultTimeSeriesOperators.CreateProblemInjector(); 49 48 } 50 49 51 protected override IOperator CreateBestSolutionProcessor() { 52 SequentialProcessor seq = new SequentialProcessor(); 53 seq.AddSubOperator(base.CreateBestSolutionProcessor()); 54 seq.AddSubOperator(BestSolutionProcessor); 55 return seq; 50 protected override IOperator CreateFunctionLibraryInjector() { 51 return DefaultTimeSeriesOperators.CreateFunctionLibraryInjector(); 56 52 } 57 53 58 p ublic override IEditor CreateEditor() {59 return new StandardGpEditor(this);54 protected override IOperator CreatePostProcessingOperator() { 55 return DefaultTimeSeriesOperators.CreatePostProcessingOperator(); 60 56 } 61 57 62 public override IView CreateView() { 63 return new StandardGpEditor(this); 64 } 65 66 internal static IOperator BestSolutionProcessor { 67 get { 68 SequentialProcessor seq = new SequentialProcessor(); 69 TheilInequalityCoefficientEvaluator trainingTheil = new TheilInequalityCoefficientEvaluator(); 70 trainingTheil.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 71 trainingTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 72 trainingTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TrainingTheilInequalityCoefficient"; 73 trainingTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TrainingTheilInequalityCoefficientBias"; 74 trainingTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "TrainingTheilInequalityCoefficientVariance"; 75 trainingTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "TrainingTheilInequalityCoefficientCovariance"; 76 77 TheilInequalityCoefficientEvaluator validationTheil = new TheilInequalityCoefficientEvaluator(); 78 validationTheil.GetVariableInfo("SamplesStart").ActualName = "ActualValidationSamplesStart"; 79 validationTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualValidationSamplesEnd"; 80 validationTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "ValidationTheilInequalityCoefficient"; 81 validationTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "ValidationTheilInequalityCoefficientBias"; 82 validationTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "ValidationTheilInequalityCoefficientVariance"; 83 validationTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "ValidationTheilInequalityCoefficientCovariance"; 84 85 TheilInequalityCoefficientEvaluator testTheil = new TheilInequalityCoefficientEvaluator(); 86 testTheil.GetVariableInfo("SamplesStart").ActualName = "ActualTestSamplesStart"; 87 testTheil.GetVariableInfo("SamplesEnd").ActualName = "ActualTestSamplesEnd"; 88 testTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TestTheilInequalityCoefficient"; 89 testTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TestTheilInequalityCoefficientBias"; 90 testTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "TestTheilInequalityCoefficientVariance"; 91 testTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "TestTheilInequalityCoefficientCovariance"; 92 93 SimpleEvaluator trainingEvaluator = new SimpleEvaluator(); 94 trainingEvaluator.GetVariableInfo("SamplesStart").ActualName = "ActualTrainingSamplesStart"; 95 trainingEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ActualTrainingSamplesEnd"; 96 trainingEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesTraining"; 97 98 SimpleEvaluator validationEvaluator = new SimpleEvaluator(); 99 validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart"; 100 validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd"; 101 validationEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesValidation"; 102 103 SimpleEvaluator testEvaluator = new SimpleEvaluator(); 104 testEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart"; 105 testEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd"; 106 testEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesTest"; 107 108 LinechartInjector trainingChartInjector = new LinechartInjector(); 109 trainingChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2; 110 trainingChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesTraining"; 111 trainingChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartTrainingPredictedValues"; 112 113 LinechartInjector validationChartInjector = new LinechartInjector(); 114 validationChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2; 115 validationChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesValidation"; 116 validationChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartValidationPredictedValues"; 117 118 LinechartInjector testChartInjector = new LinechartInjector(); 119 testChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2; 120 testChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesTest"; 121 testChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartTestPredictedValues"; 122 123 seq.AddSubOperator(trainingTheil); 124 seq.AddSubOperator(validationTheil); 125 seq.AddSubOperator(testTheil); 126 seq.AddSubOperator(trainingEvaluator); 127 seq.AddSubOperator(trainingChartInjector); 128 seq.AddSubOperator(validationEvaluator); 129 seq.AddSubOperator(validationChartInjector); 130 seq.AddSubOperator(testEvaluator); 131 seq.AddSubOperator(testChartInjector); 132 133 return seq; 134 } 58 protected override VariableInjector CreateGlobalInjector() { 59 VariableInjector injector = base.CreateGlobalInjector(); 60 injector.AddVariable(new HeuristicLab.Core.Variable("MinTimeOffset", new IntData())); 61 injector.AddVariable(new HeuristicLab.Core.Variable("MaxTimeOffset", new IntData())); 62 injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData())); 63 return injector; 135 64 } 136 65 }
Note: See TracChangeset
for help on using the changeset viewer.