[4401] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
| 3 | * Copyright (C) 2002-2010 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.Collections.Generic;
|
---|
| 23 | using HeuristicLab.Common;
|
---|
| 24 | using HeuristicLab.Core;
|
---|
| 25 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
| 26 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
|
---|
| 27 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 28 | using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Symbols;
|
---|
| 29 | using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
|
---|
| 30 | using System.Linq;
|
---|
| 31 | using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Interfaces;
|
---|
| 32 |
|
---|
| 33 | namespace HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic {
|
---|
| 34 | [StorableClass]
|
---|
| 35 | [Item("SymbolicTimeSeriesPrognosisModel", "Represents a model for time series prognosis.")]
|
---|
| 36 | public class SymbolicTimeSeriesPrognosisModel : NamedItem, IMultiVariateDataAnalysisModel {
|
---|
| 37 | [Storable]
|
---|
| 38 | private ISymbolicTimeSeriesExpressionInterpreter interpreter;
|
---|
[4463] | 39 | public ISymbolicTimeSeriesExpressionInterpreter Interpreter {
|
---|
| 40 | get { return interpreter; }
|
---|
| 41 | }
|
---|
[4401] | 42 | [Storable]
|
---|
| 43 | private SymbolicExpressionTree tree;
|
---|
| 44 | public SymbolicExpressionTree SymbolicExpressionTree {
|
---|
| 45 | get { return tree; }
|
---|
| 46 | }
|
---|
| 47 | [StorableConstructor]
|
---|
| 48 | protected SymbolicTimeSeriesPrognosisModel(bool deserializing) : base(deserializing) { }
|
---|
[5275] | 49 | protected SymbolicTimeSeriesPrognosisModel(SymbolicTimeSeriesPrognosisModel original, Cloner cloner)
|
---|
| 50 | : base(original, cloner) {
|
---|
| 51 | tree = cloner.Clone(original.tree);
|
---|
| 52 | interpreter = cloner.Clone(original.interpreter);
|
---|
| 53 | }
|
---|
[4401] | 54 | public SymbolicTimeSeriesPrognosisModel() { }
|
---|
| 55 | public SymbolicTimeSeriesPrognosisModel(ISymbolicTimeSeriesExpressionInterpreter interpreter, SymbolicExpressionTree tree) {
|
---|
| 56 | this.tree = tree;
|
---|
| 57 | this.interpreter = interpreter;
|
---|
| 58 |
|
---|
| 59 | }
|
---|
| 60 |
|
---|
[5275] | 61 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 62 | return new SymbolicTimeSeriesPrognosisModel(this, cloner);
|
---|
| 63 | }
|
---|
| 64 |
|
---|
[4401] | 65 | public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end, int horizon) {
|
---|
| 66 | IEnumerable<int> rows = Enumerable.Range(start, end - start);
|
---|
| 67 | IEnumerable<string> targetVariables = from item in problemData.TargetVariables.CheckedItems
|
---|
| 68 | select item.Value.Value;
|
---|
| 69 | return interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, targetVariables, rows, horizon);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | #region IMultiVariateDataAnalysisModel Members
|
---|
| 73 |
|
---|
| 74 | public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end) {
|
---|
| 75 | return GetEstimatedValues(problemData, start, end, 1);
|
---|
| 76 | }
|
---|
| 77 | #endregion
|
---|
| 78 |
|
---|
| 79 | }
|
---|
| 80 | } |
---|