Free cookie consent management tool by TermsFeed Policy Generator

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

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

Merged changes from trunk to data analysis exploration branch and added fractional distance metric evaluator. #1142

File size: 3.5 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    public ISymbolicTimeSeriesExpressionInterpreter Interpreter {
40      get { return interpreter; }
41    }
42    [Storable]
43    private SymbolicExpressionTree tree;
44    public SymbolicExpressionTree SymbolicExpressionTree {
45      get { return tree; }
46    }
47    [StorableConstructor]
48    protected SymbolicTimeSeriesPrognosisModel(bool deserializing) : base(deserializing) { }
49    protected SymbolicTimeSeriesPrognosisModel(SymbolicTimeSeriesPrognosisModel original, Cloner cloner)
50      : base(original, cloner) {
51        tree = cloner.Clone(original.tree);
52        interpreter = cloner.Clone(original.interpreter);
53    }
54    public SymbolicTimeSeriesPrognosisModel() { }
55    public SymbolicTimeSeriesPrognosisModel(ISymbolicTimeSeriesExpressionInterpreter interpreter, SymbolicExpressionTree tree) {
56      this.tree = tree;
57      this.interpreter = interpreter;
58
59    }
60
61    public override IDeepCloneable Clone(Cloner cloner) {
62      return new SymbolicTimeSeriesPrognosisModel(this, cloner);
63    }
64
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}
Note: See TracBrowser for help on using the repository browser.