Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs @ 3532

Last change on this file since 3532 was 3513, checked in by gkronber, 15 years ago

Added upper and lower estimation limits. #938 (Data types and operators for regression problems)

File size: 3.1 KB
RevLine 
[3442]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;
23using System.Collections.Generic;
24using System.Linq;
25using System.Drawing;
26using HeuristicLab.Common;
27using HeuristicLab.Core;
28using HeuristicLab.Data;
29using HeuristicLab.Optimization;
30using HeuristicLab.Parameters;
31using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
32using HeuristicLab.PluginInfrastructure;
33using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
34using HeuristicLab.Problems.DataAnalysis;
35using HeuristicLab.Operators;
36using HeuristicLab.Problems.DataAnalysis.Symbolic;
37
38namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic {
39  [StorableClass]
[3462]40  [Item("SymbolicRegressionModel", "A symbolic regression model represents an entity that provides estimated values based on input values.")]
41  public class SymbolicRegressionModel : Item {
[3442]42    [Storable]
43    private SymbolicExpressionTree tree;
44    public SymbolicExpressionTree SymbolicExpressionTree {
45      get { return tree; }
46    }
47    [Storable]
[3462]48    private ISymbolicExpressionTreeInterpreter interpreter;
49    public ISymbolicExpressionTreeInterpreter Interpreter {
50      get { return interpreter; }
[3442]51    }
[3462]52    [Storable]
53    private List<string> inputVariables;
54    public IEnumerable<string> InputVariables {
55      get { return inputVariables.AsEnumerable(); }
56    }
[3442]57    public SymbolicRegressionModel() : base() { } // for cloning
58
[3462]59    public SymbolicRegressionModel(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree tree, IEnumerable<string> inputVariables)
[3442]60      : base() {
61      this.tree = tree;
[3462]62      this.interpreter = interpreter;
63      this.inputVariables = inputVariables.ToList();
[3442]64    }
65
[3462]66    public IEnumerable<double> GetEstimatedValues(Dataset dataset, int start, int end) {
67      return interpreter.GetSymbolicExpressionTreeValues(tree, dataset, Enumerable.Range(start, end - start));
68    }
[3442]69
[3462]70    public override IDeepCloneable Clone(Cloner cloner) {
71      var clone = (SymbolicRegressionModel)base.Clone(cloner);
[3493]72      clone.tree = (SymbolicExpressionTree)cloner.Clone(tree);
73      clone.interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(interpreter);
[3462]74      clone.inputVariables = new List<string>(inputVariables);
75      return clone;
[3442]76    }
77  }
78}
Note: See TracBrowser for help on using the repository browser.