1 | using System.Collections.Generic;
|
---|
2 | using System.Linq;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
6 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
7 | using HeuristicLab.Problems.DataAnalysis;
|
---|
8 |
|
---|
9 | namespace HeuristicLab.Problems.GaussianProcessTuning {
|
---|
10 | [StorableClass]
|
---|
11 | [Item("GaussianProcessRegressionModel", "A Gaussian process model")]
|
---|
12 | public class GaussianProcessRegressionModel : NamedItem, IRegressionModel {
|
---|
13 | [Storable]
|
---|
14 | private ISymbolicExpressionTree configuration;
|
---|
15 | public ISymbolicExpressionTree Configuration { get { return configuration; } }
|
---|
16 |
|
---|
17 | [Storable]
|
---|
18 | private IRegressionProblemData trainingData;
|
---|
19 | [Storable]
|
---|
20 | private Interpreter interpreter;
|
---|
21 |
|
---|
22 | [StorableConstructor]
|
---|
23 | protected GaussianProcessRegressionModel(bool deserializing) : base(deserializing) { }
|
---|
24 | protected GaussianProcessRegressionModel(GaussianProcessRegressionModel original, Cloner cloner)
|
---|
25 | : base(original, cloner) {
|
---|
26 | this.configuration = cloner.Clone(original.configuration);
|
---|
27 | this.trainingData = cloner.Clone(original.trainingData);
|
---|
28 | this.interpreter = cloner.Clone(original.interpreter);
|
---|
29 | }
|
---|
30 | public GaussianProcessRegressionModel(ISymbolicExpressionTree configuration, IRegressionProblemData trainingData, Interpreter interpreter) {
|
---|
31 | this.Name = "GaussianProcessRegressionModel";
|
---|
32 | this.Description = "A Gaussian process model";
|
---|
33 | this.configuration = configuration;
|
---|
34 | this.trainingData = trainingData;
|
---|
35 | this.interpreter = interpreter;
|
---|
36 | }
|
---|
37 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
38 | return new GaussianProcessRegressionModel(this, cloner);
|
---|
39 | }
|
---|
40 |
|
---|
41 | public IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
|
---|
42 | return new Solution(this, problemData);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
|
---|
46 | //if (!rows.Any()) return Enumerable.Empty<double>();
|
---|
47 |
|
---|
48 | //double[] means, variances;
|
---|
49 | //interpreter.EvaluateGaussianProcessConfiguration(configuration, trainingData, dataset, rows, out means,
|
---|
50 | // out variances);
|
---|
51 | //return means;
|
---|
52 | return rows.Select(x => 0.0);
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|