1 | using HEAL.Attic;
|
---|
2 | using HeuristicLab.Common;
|
---|
3 | using HeuristicLab.Core;
|
---|
4 | using HeuristicLab.Data;
|
---|
5 | using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
|
---|
6 | using HeuristicLab.Optimization;
|
---|
7 | using HeuristicLab.Parameters;
|
---|
8 | using HeuristicLab.Problems.DataAnalysis;
|
---|
9 | using HeuristicLab.Problems.DataAnalysis.Symbolic;
|
---|
10 | using HeuristicLab.Problems.DataAnalysis.Symbolic.Regression;
|
---|
11 | using System;
|
---|
12 | using System.Collections.Generic;
|
---|
13 | using System.Linq;
|
---|
14 | using System.Text;
|
---|
15 | using System.Threading.Tasks;
|
---|
16 |
|
---|
17 | namespace HeuristicLab.Algorithms.OESRALPS.Analyzers.Regression
|
---|
18 | {
|
---|
19 | [Item("SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer", "An operator that analyzes the training best symbolic regression solution for single objective symbolic regression problems.")]
|
---|
20 | [StorableType("85786F8E-A81D-4909-9A66-620669A0C7FB")]
|
---|
21 | public sealed class SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer
|
---|
22 | : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer<ISymbolicRegressionSolution, ISymbolicRegressionSingleObjectiveEvaluator, IRegressionProblemData>,
|
---|
23 | ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator
|
---|
24 | {
|
---|
25 | private const string ProblemDataParameterName = "ProblemData";
|
---|
26 | private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicExpressionTreeInterpreter";
|
---|
27 | private const string EstimationLimitsParameterName = "EstimationLimits";
|
---|
28 |
|
---|
29 | #region parameter properties
|
---|
30 | public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter {
|
---|
31 | get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
|
---|
32 | }
|
---|
33 | #endregion
|
---|
34 |
|
---|
35 | [StorableConstructor]
|
---|
36 | private SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
|
---|
37 | private SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer(SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer original, Cloner cloner) : base(original, cloner) { }
|
---|
38 | public SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer()
|
---|
39 | : base()
|
---|
40 | {
|
---|
41 | Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model."));
|
---|
42 | }
|
---|
43 | public override IDeepCloneable Clone(Cloner cloner)
|
---|
44 | {
|
---|
45 | return new SymbolicRegressionSingleObjectiveTrainingBestSolutionSlidingWindowAnalyzer(this, cloner);
|
---|
46 | }
|
---|
47 |
|
---|
48 | protected override ISymbolicRegressionSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality)
|
---|
49 | {
|
---|
50 | var model = new SymbolicRegressionModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
|
---|
51 | if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
|
---|
52 | return new SymbolicRegressionSolution(model, (IRegressionProblemData)ProblemDataParameter.ActualValue.Clone());
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|