[1050] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
| 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 | using System.Text;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using System.Xml;
|
---|
| 28 | using System.Diagnostics;
|
---|
| 29 | using HeuristicLab.DataAnalysis;
|
---|
| 30 | using HeuristicLab.Data;
|
---|
[1287] | 31 | using HeuristicLab.Operators;
|
---|
| 32 | using HeuristicLab.Logging;
|
---|
[1856] | 33 | using HeuristicLab.Modeling;
|
---|
[1050] | 34 |
|
---|
[1245] | 35 | namespace HeuristicLab.GP.StructureIdentification.TimeSeries {
|
---|
[1857] | 36 | public class StandardGP : HeuristicLab.GP.StructureIdentification.StandardGP, ITimeSeriesAlgorithm {
|
---|
[1287] | 37 | public bool Autoregressive {
|
---|
| 38 | get { return ProblemInjector.GetVariable("Autoregressive").GetValue<BoolData>().Data; }
|
---|
| 39 | set { ProblemInjector.GetVariable("Autoregressive").GetValue<BoolData>().Data = value; }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
[1245] | 42 | protected override IOperator CreateFunctionLibraryInjector() {
|
---|
[1230] | 43 | return new FunctionLibraryInjector();
|
---|
[1050] | 44 | }
|
---|
| 45 |
|
---|
[1287] | 46 | protected override IOperator CreateProblemInjector() {
|
---|
| 47 | return new ProblemInjector();
|
---|
| 48 | }
|
---|
| 49 |
|
---|
[1245] | 50 | protected override IOperator CreateBestSolutionProcessor() {
|
---|
| 51 | IOperator seq = base.CreateBestSolutionProcessor();
|
---|
[1287] | 52 | seq.AddSubOperator(BestSolutionProcessor);
|
---|
| 53 | return seq;
|
---|
| 54 | }
|
---|
[1050] | 55 |
|
---|
[1287] | 56 | public override IEditor CreateEditor() {
|
---|
| 57 | return new StandardGpEditor(this);
|
---|
| 58 | }
|
---|
[1050] | 59 |
|
---|
[1287] | 60 | public override IView CreateView() {
|
---|
| 61 | return new StandardGpEditor(this);
|
---|
| 62 | }
|
---|
[1051] | 63 |
|
---|
[1287] | 64 | internal static IOperator BestSolutionProcessor {
|
---|
| 65 | get {
|
---|
| 66 | SequentialProcessor seq = new SequentialProcessor();
|
---|
| 67 | TheilInequalityCoefficientEvaluator trainingTheil = new TheilInequalityCoefficientEvaluator();
|
---|
| 68 | trainingTheil.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 69 | trainingTheil.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 70 | trainingTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TrainingTheilInequalityCoefficient";
|
---|
| 71 | trainingTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TrainingTheilInequalityCoefficientBias";
|
---|
| 72 | trainingTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "TrainingTheilInequalityCoefficientVariance";
|
---|
| 73 | trainingTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "TrainingTheilInequalityCoefficientCovariance";
|
---|
[1051] | 74 |
|
---|
[1287] | 75 | TheilInequalityCoefficientEvaluator validationTheil = new TheilInequalityCoefficientEvaluator();
|
---|
| 76 | validationTheil.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 77 | validationTheil.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 78 | validationTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "ValidationTheilInequalityCoefficient";
|
---|
| 79 | validationTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "ValidationTheilInequalityCoefficientBias";
|
---|
| 80 | validationTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "ValidationTheilInequalityCoefficientVariance";
|
---|
| 81 | validationTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "ValidationTheilInequalityCoefficientCovariance";
|
---|
| 82 |
|
---|
| 83 | TheilInequalityCoefficientEvaluator testTheil = new TheilInequalityCoefficientEvaluator();
|
---|
| 84 | testTheil.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 85 | testTheil.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 86 | testTheil.GetVariableInfo("TheilInequalityCoefficient").ActualName = "TestTheilInequalityCoefficient";
|
---|
| 87 | testTheil.GetVariableInfo("TheilInequalityCoefficientBias").ActualName = "TestTheilInequalityCoefficientBias";
|
---|
| 88 | testTheil.GetVariableInfo("TheilInequalityCoefficientVariance").ActualName = "TestTheilInequalityCoefficientVariance";
|
---|
| 89 | testTheil.GetVariableInfo("TheilInequalityCoefficientCovariance").ActualName = "TestTheilInequalityCoefficientCovariance";
|
---|
| 90 |
|
---|
| 91 | SimpleEvaluator trainingEvaluator = new SimpleEvaluator();
|
---|
| 92 | trainingEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
|
---|
| 93 | trainingEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TrainingSamplesEnd";
|
---|
| 94 | trainingEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesTraining";
|
---|
| 95 |
|
---|
| 96 | SimpleEvaluator validationEvaluator = new SimpleEvaluator();
|
---|
| 97 | validationEvaluator.GetVariableInfo("SamplesStart").ActualName = "ValidationSamplesStart";
|
---|
| 98 | validationEvaluator.GetVariableInfo("SamplesEnd").ActualName = "ValidationSamplesEnd";
|
---|
| 99 | validationEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesValidation";
|
---|
| 100 |
|
---|
| 101 | SimpleEvaluator testEvaluator = new SimpleEvaluator();
|
---|
| 102 | testEvaluator.GetVariableInfo("SamplesStart").ActualName = "TestSamplesStart";
|
---|
| 103 | testEvaluator.GetVariableInfo("SamplesEnd").ActualName = "TestSamplesEnd";
|
---|
| 104 | testEvaluator.GetVariableInfo("Values").ActualName = "PredictedValuesTest";
|
---|
| 105 |
|
---|
| 106 | LinechartInjector trainingChartInjector = new LinechartInjector();
|
---|
| 107 | trainingChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2;
|
---|
| 108 | trainingChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesTraining";
|
---|
| 109 | trainingChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartTrainingPredictedValues";
|
---|
| 110 |
|
---|
| 111 | LinechartInjector validationChartInjector = new LinechartInjector();
|
---|
| 112 | validationChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2;
|
---|
| 113 | validationChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesValidation";
|
---|
| 114 | validationChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartValidationPredictedValues";
|
---|
| 115 |
|
---|
| 116 | LinechartInjector testChartInjector = new LinechartInjector();
|
---|
| 117 | testChartInjector.GetVariableValue<IntData>("NumberOfLines", null, false).Data = 2;
|
---|
| 118 | testChartInjector.GetVariableInfo("Values").ActualName = "PredictedValuesTest";
|
---|
| 119 | testChartInjector.GetVariableInfo("Linechart").ActualName = "LinechartTestPredictedValues";
|
---|
| 120 |
|
---|
| 121 | seq.AddSubOperator(trainingTheil);
|
---|
| 122 | seq.AddSubOperator(validationTheil);
|
---|
| 123 | seq.AddSubOperator(testTheil);
|
---|
| 124 | seq.AddSubOperator(trainingEvaluator);
|
---|
| 125 | seq.AddSubOperator(trainingChartInjector);
|
---|
| 126 | seq.AddSubOperator(validationEvaluator);
|
---|
| 127 | seq.AddSubOperator(validationChartInjector);
|
---|
| 128 | seq.AddSubOperator(testEvaluator);
|
---|
| 129 | seq.AddSubOperator(testChartInjector);
|
---|
| 130 |
|
---|
| 131 | return seq;
|
---|
| 132 | }
|
---|
[1050] | 133 | }
|
---|
| 134 | }
|
---|
| 135 | }
|
---|