Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis/3.3/Symbolic/SymbolicTimeSeriesPrognosisModel.cs @ 4401

Last change on this file since 4401 was 4401, checked in by gkronber, 14 years ago

Added model and solution classes for time series prognosis and added views for time series prognosis solutions. #1142

File size: 3.4 KB
Line 
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
22using System.Collections.Generic;
23using HeuristicLab.Common;
24using HeuristicLab.Core;
25using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
28using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Symbols;
29using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
30using System.Linq;
31using HeuristicLab.Problems.DataAnalysis.MultiVariate.TimeSeriesPrognosis.Symbolic.Interfaces;
32
33namespace 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;
39    [Storable]
40    private SymbolicExpressionTree tree;
41    public SymbolicExpressionTree SymbolicExpressionTree {
42      get { return tree; }
43    }
44    [StorableConstructor]
45    protected SymbolicTimeSeriesPrognosisModel(bool deserializing) : base(deserializing) { }
46
47    public SymbolicTimeSeriesPrognosisModel() { }
48
49    public SymbolicTimeSeriesPrognosisModel(ISymbolicTimeSeriesExpressionInterpreter interpreter, SymbolicExpressionTree tree) {
50      this.tree = tree;
51      this.interpreter = interpreter;
52
53    }
54
55    public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end, int horizon) {
56      IEnumerable<int> rows = Enumerable.Range(start, end - start);
57      IEnumerable<string> targetVariables = from item in problemData.TargetVariables.CheckedItems
58                                            select item.Value.Value;
59      return interpreter.GetSymbolicExpressionTreeValues(tree, problemData.Dataset, targetVariables, rows, horizon);
60    }
61
62    #region IMultiVariateDataAnalysisModel Members
63
64    public IEnumerable<double[]> GetEstimatedValues(MultiVariateDataAnalysisProblemData problemData, int start, int end) {
65      return GetEstimatedValues(problemData, start, end, 1);
66    }
67    #endregion
68
69    public override IDeepCloneable Clone(Cloner cloner) {
70      SymbolicTimeSeriesPrognosisModel clone = (SymbolicTimeSeriesPrognosisModel)base.Clone(cloner);
71      clone.tree = (SymbolicExpressionTree)cloner.Clone(tree);
72      clone.interpreter = (ISymbolicTimeSeriesExpressionInterpreter)cloner.Clone(interpreter);
73      return clone;
74    }
75  }
76}
Note: See TracBrowser for help on using the repository browser.