Rev | Line | |
---|
[13865] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Drawing;
|
---|
| 4 | using System.Linq;
|
---|
| 5 | using System.Text;
|
---|
| 6 | using System.Threading.Tasks;
|
---|
| 7 | using HeuristicLab.Common;
|
---|
| 8 | using HeuristicLab.Core;
|
---|
| 9 | using HeuristicLab.Data;
|
---|
| 10 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
| 11 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 12 | using HeuristicLab.Problems.DataAnalysis;
|
---|
| 13 |
|
---|
| 14 | namespace HeuristicLab.Problems.GeneticProgramming.GlucosePrediction {
|
---|
| 15 | [StorableClass]
|
---|
| 16 | [Item("Model", "")]
|
---|
| 17 | public sealed class Model : NamedItem, IRegressionModel {
|
---|
| 18 | private readonly IRegressionProblemData problemData;
|
---|
| 19 | private readonly ISymbolicExpressionTree tree;
|
---|
| 20 |
|
---|
| 21 | private Model(Model original, Cloner cloner) {
|
---|
| 22 | this.problemData = cloner.Clone(original.problemData);
|
---|
| 23 | this.tree = cloner.Clone(original.tree);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public Model(IRegressionProblemData problemData, ISymbolicExpressionTree tree) {
|
---|
| 27 | this.problemData = problemData;
|
---|
| 28 | this.tree = tree;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 32 | return new Model(this, cloner);
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
|
---|
| 36 | return Interpreter.Apply(tree.Root.GetSubtree(0).GetSubtree(0), problemData.Dataset, rows);
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
|
---|
| 40 | return new Solution(this, problemData);
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.