Changeset 7120 for branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis
- Timestamp:
- 12/05/11 08:22:36 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4
- Files:
-
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4.csproj
r7100 r7120 111 111 <ItemGroup> 112 112 <Compile Include="Interfaces\ISymbolicTimeSeriesPrognosisInterpreterOperator.cs" /> 113 <Compile Include="Interfaces\ISymbolicTimeSeriesPrognogisInterpreter.cs" />114 113 <Compile Include="Interfaces\ISymbolicTimeSeriesPrognosisEvaluator.cs" /> 115 114 <Compile Include="Interfaces\ISymbolicTimeSeriesPrognosisModel.cs" /> … … 122 121 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveProblem.cs" /> 123 122 <Compile Include="SingleObjective\SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer.cs" /> 124 <Compile Include="SymbolicTimeSeriesPrognosisInterpreter.cs" />125 123 <Compile Include="SymbolicTimeSeriesPrognosisModel.cs" /> 126 124 <Compile Include="SymbolicTimeSeriesPrognosisSolution.cs" /> … … 139 137 <Name>HeuristicLab.Collections-3.3</Name> 140 138 </ProjectReference> 139 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 140 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 141 <Name>HeuristicLab.Common.Resources-3.3</Name> 142 </ProjectReference> 141 143 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 142 144 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> … … 182 184 <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project> 183 185 <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name> 186 </ProjectReference> 187 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 188 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project> 189 <Name>HeuristicLab.Random-3.3</Name> 184 190 </ProjectReference> 185 191 </ItemGroup> -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/Interfaces/ISymbolicTimeSeriesPrognosisEvaluator.cs
r6802 r7120 20 20 #endregion 21 21 22 using HeuristicLab.Core; 23 using HeuristicLab.Data; 22 24 23 25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis { 24 26 public interface ISymbolicTimeSeriesPrognosisEvaluator : ISymbolicDataAnalysisEvaluator<ITimeSeriesPrognosisProblemData> { 27 IValueLookupParameter<IntValue> HorizonParameter { get; } 25 28 } 26 29 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/Interfaces/ISymbolicTimeSeriesPrognosisInterpreterOperator.cs
r7100 r7120 24 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis { 25 25 public interface ISymbolicTimeSeriesPrognosisInterpreterOperator : IOperator { 26 ILookupParameter<ISymbolicTimeSeriesPrognosis Interpreter> SymbolicTimeSeriesPrognosisInterpreterParameter { get; }26 ILookupParameter<ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter> SymbolicTimeSeriesPrognosisInterpreterParameter { get; } 27 27 } 28 28 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/Interfaces/ISymbolicTimeSeriesPrognosisModel.cs
r6802 r7120 22 22 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 23 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis { 24 public interface ISymbolicTimeSeriesPrognosisModel : ITimeSeriesPrognosisModel, ISymbolicDataAnalysisModel { 24 public interface ISymbolicTimeSeriesPrognosisModel : ITimeSeriesPrognosisModel { 25 ISymbolicExpressionTree SymbolicExpressionTree { get; } 26 ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter Interpreter { get; } 25 27 } 26 28 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveEvaluator.cs
r6802 r7120 22 22 23 23 using HeuristicLab.Common; 24 using HeuristicLab.Core; 25 using HeuristicLab.Data; 26 using HeuristicLab.Parameters; 24 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis { 26 29 public abstract class SymbolicTimeSeriesPrognosisSingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<ITimeSeriesPrognosisProblemData>, ISymbolicTimeSeriesPrognosisSingleObjectiveEvaluator { 30 private const string HorizonParameterName = "Horizon"; 31 32 public IValueLookupParameter<IntValue> HorizonParameter { 33 get { return (IValueLookupParameter<IntValue>)Parameters[HorizonParameterName]; } 34 } 35 27 36 [StorableConstructor] 28 37 protected SymbolicTimeSeriesPrognosisSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { } … … 31 40 } 32 41 33 protected SymbolicTimeSeriesPrognosisSingleObjectiveEvaluator() : base() { } 42 protected SymbolicTimeSeriesPrognosisSingleObjectiveEvaluator() 43 : base() { 44 Parameters.Add(new ValueLookupParameter<IntValue>(HorizonParameterName, "The time interval for which the prognosis should be calculated.", new IntValue(1))); 45 } 34 46 } 35 47 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveMeanSquaredErrorEvaluator.cs
r7100 r7120 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 48 50 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 51 50 double quality = Calculate(SymbolicTimeSeriesPrognosisInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, 53 solution, 54 EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, 55 ProblemDataParameter.ActualValue, 56 rows, HorizonParameter.ActualValue.Value); 51 57 QualityParameter.ActualValue = new DoubleValue(quality); 52 58 … … 54 60 } 55 61 56 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows) { 57 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 58 OnlineMeanAndVarianceCalculator meanCalculator = new OnlineMeanAndVarianceCalculator(); 62 public static double Calculate(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows, int horizon) { 63 var allPredictedContinuations = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, problemData.TargetVariables.ToArray(), rows, horizon); 64 var meanCalculator = new OnlineMeanAndVarianceCalculator(); 65 var allPredictedContinuationsEnumerator = allPredictedContinuations.GetEnumerator(); 59 66 foreach (var targetVariable in problemData.TargetVariables) { 60 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(targetVariable, rows); 61 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, 62 upperEstimationLimit); 63 OnlineCalculatorError errorState; 64 meanCalculator.Add(OnlineMeanSquaredErrorCalculator.Calculate(originalValues, boundedEstimationValues, out errorState)); 65 if (errorState != OnlineCalculatorError.None) return double.NaN; 67 if (!allPredictedContinuationsEnumerator.MoveNext()) throw new InvalidOperationException(); 68 var actualContinuations = from r in rows 69 select problemData.Dataset.GetDoubleValues(targetVariable, Enumerable.Range(r, horizon)); 70 var actualContinuationsEnumerator = actualContinuations.GetEnumerator(); 71 var predictedContinuationsEnumerator = allPredictedContinuationsEnumerator.Current.GetEnumerator(); 72 while (actualContinuationsEnumerator.MoveNext() & predictedContinuationsEnumerator.MoveNext()) { 73 OnlineCalculatorError errorState; 74 meanCalculator.Add(OnlineMeanSquaredErrorCalculator.Calculate(predictedContinuationsEnumerator.Current.LimitToRange(lowerEstimationLimit, upperEstimationLimit), 75 actualContinuationsEnumerator.Current, out errorState)); 76 if (errorState != OnlineCalculatorError.None) return double.NaN; 77 } 66 78 } 67 79 return meanCalculator.Mean; … … 69 81 70 82 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows) { 71 Symbolic TimeSeriesPrognosisInterpreterParameter.ExecutionContext = context;83 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 72 84 EstimationLimitsParameter.ExecutionContext = context; 85 HorizonParameter.ExecutionContext = context; 73 86 74 double mse = Calculate(Symbolic TimeSeriesPrognosisInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);87 double mse = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, HorizonParameter.ActualValue.Value); 75 88 76 77 Symbolic TimeSeriesPrognosisInterpreterParameter.ExecutionContext = null;89 HorizonParameter.ExecutionContext = null; 90 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 78 91 EstimationLimitsParameter.ExecutionContext = null; 79 92 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectivePearsonRSquaredEvaluator.cs
r7100 r7120 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 24 using System.Linq; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; … … 48 50 IEnumerable<int> rows = GenerateRowsToEvaluate(); 49 51 50 double quality = Calculate(SymbolicTimeSeriesPrognosisInterpreterParameter.ActualValue, solution, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, ProblemDataParameter.ActualValue, rows); 52 double quality = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, solution, 53 EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, 54 ProblemDataParameter.ActualValue, 55 rows, HorizonParameter.ActualValue.Value); 51 56 QualityParameter.ActualValue = new DoubleValue(quality); 52 57 … … 54 59 } 55 60 56 public static double Calculate(ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows) { 57 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 61 public static double Calculate(ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, ISymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows, int horizon) { 62 var allPredictedContinuations = 63 interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, problemData.TargetVariables.ToArray(), 64 rows, horizon).ToArray(); 65 58 66 var meanCalculator = new OnlineMeanAndVarianceCalculator(); 67 int i = 0; 59 68 foreach (var targetVariable in problemData.TargetVariables) { 60 IEnumerable<double> originalValues = problemData.Dataset.GetDoubleValues(targetVariable, rows); 69 var actualContinuations = from r in rows 70 select problemData.Dataset.GetDoubleValues(targetVariable, Enumerable.Range(r, horizon)); 71 var startValues = problemData.Dataset.GetDoubleValues(targetVariable, rows.Select(r => r - 1)); 61 72 OnlineCalculatorError errorState; 62 meanCalculator.Add(OnlinePearsonsRSquaredCalculator.Calculate(estimatedValues, originalValues, out errorState)); 63 if (errorState != OnlineCalculatorError.None) return 0.0; 73 meanCalculator.Add(OnlineTheilsUStatisticCalculator.Calculate( 74 startValues, 75 allPredictedContinuations.Select(v => v.ElementAt(i)), 76 actualContinuations, out errorState)); 77 if (errorState != OnlineCalculatorError.None) return double.NaN; 78 i++; 64 79 } 65 80 return meanCalculator.Mean; … … 67 82 68 83 public override double Evaluate(IExecutionContext context, ISymbolicExpressionTree tree, ITimeSeriesPrognosisProblemData problemData, IEnumerable<int> rows) { 69 Symbolic TimeSeriesPrognosisInterpreterParameter.ExecutionContext = context;84 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = context; 70 85 EstimationLimitsParameter.ExecutionContext = context; 86 HorizonParameter.ExecutionContext = context; 71 87 72 double r2 = Calculate(Symbolic TimeSeriesPrognosisInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows);88 double r2 = Calculate(SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, tree, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper, problemData, rows, HorizonParameter.ActualValue.Value); 73 89 74 SymbolicTimeSeriesPrognosisInterpreterParameter.ExecutionContext = null; 90 HorizonParameter.ExecutionContext = null; 91 SymbolicDataAnalysisTreeInterpreterParameter.ExecutionContext = null; 75 92 EstimationLimitsParameter.ExecutionContext = null; 76 93 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveProblem.cs
r7100 r7120 31 31 [Creatable("Problems")] 32 32 public class SymbolicTimeSeriesPrognosisSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<ITimeSeriesPrognosisProblemData, ISymbolicTimeSeriesPrognosisSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, ITimeSeriesPrognosisProblem { 33 private const double PunishmentFactor = 10;34 33 private const int InitialMaximumTreeDepth = 8; 35 34 private const int InitialMaximumTreeLength = 25; -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SingleObjective/SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer.cs
r7100 r7120 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 34 35 [StorableClass] 35 36 public sealed class SymbolicTimeSeriesPrognosisSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicTimeSeriesPrognosisSolution>, 36 ISymbolic TimeSeriesPrognosisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator {37 ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator { 37 38 private const string ProblemDataParameterName = "ProblemData"; 38 private const string Symbolic TimeSeriesPrognosisInterpreterParameterName = "SymbolicTimeSeriesPrognosisInterpreter";39 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 39 40 private const string EstimationLimitsParameterName = "EstimationLimits"; 40 41 private const string ApplyLinearScalingParameterName = "ApplyLinearScaling"; … … 43 44 get { return (ILookupParameter<ITimeSeriesPrognosisProblemData>)Parameters[ProblemDataParameterName]; } 44 45 } 45 public ILookupParameter<ISymbolic TimeSeriesPrognosisInterpreter> SymbolicTimeSeriesPrognosisInterpreterParameter {46 get { return (ILookupParameter<ISymbolic TimeSeriesPrognosisInterpreter>)Parameters[SymbolicTimeSeriesPrognosisInterpreterParameterName]; }46 public ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> SymbolicDataAnalysisTreeInterpreterParameter { 47 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[SymbolicDataAnalysisTreeInterpreterParameterName]; } 47 48 } 48 49 public IValueLookupParameter<DoubleLimit> EstimationLimitsParameter { … … 66 67 : base() { 67 68 Parameters.Add(new LookupParameter<ITimeSeriesPrognosisProblemData>(ProblemDataParameterName, "The problem data for the symbolic regression solution.")); 68 Parameters.Add(new LookupParameter<ISymbolic TimeSeriesPrognosisInterpreter>(SymbolicTimeSeriesPrognosisInterpreterParameterName, "The symbolic time series prognosis interpreter for the symbolic expression tree."));69 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic time series prognosis interpreter for the symbolic expression tree.")); 69 70 Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic regression model.")); 70 71 Parameters.Add(new ValueParameter<BoolValue>(ApplyLinearScalingParameterName, "Flag that indicates if the produced symbolic regression solution should be linearly scaled.", new BoolValue(true))); … … 75 76 76 77 protected override ISymbolicTimeSeriesPrognosisSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) { 77 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), Symbolic TimeSeriesPrognosisInterpreterParameter.ActualValue);78 var model = new SymbolicTimeSeriesPrognosisModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, ProblemDataParameter.ActualValue.TargetVariables.ToArray()); 78 79 if (ApplyLinearScaling.Value) 79 80 SymbolicTimeSeriesPrognosisModel.Scale(model, ProblemDataParameter.ActualValue); -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisInterpreter.cs
r7100 r7120 33 33 [StorableClass] 34 34 [Item("SymbolicTimeSeriesPrognosisInterpreter", "Interpreter for symbolic expression trees including automatically defined functions.")] 35 public sealed class SymbolicTimeSeriesPrognosisInterpreter : ParameterizedNamedItem, ISymbolicTimeSeriesPrognosis Interpreter {35 public sealed class SymbolicTimeSeriesPrognosisInterpreter : ParameterizedNamedItem, ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter { 36 36 private const string CheckExpressionsWithIntervalArithmeticParameterName = "CheckExpressionsWithIntervalArithmetic"; 37 37 #region private classes -
branches/HeuristicLab.TimeSeries/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis/3.4/SymbolicTimeSeriesPrognosisModel.cs
r7100 r7120 21 21 22 22 using System.Collections.Generic; 23 using System.Drawing; 23 24 using System.Linq; 24 25 using HeuristicLab.Common; … … 33 34 [StorableClass] 34 35 [Item(Name = "Symbolic Time-Series Prognosis Model", Description = "Represents a symbolic time series prognosis model.")] 35 public class SymbolicTimeSeriesPrognosisModel : SymbolicDataAnalysisModel, ISymbolicTimeSeriesPrognosisModel {36 public new ISymbolicTimeSeriesPrognosisInterpreter Interpreter{37 get { return (ISymbolicTimeSeriesPrognosisInterpreter)base.Interpreter; }36 public class SymbolicTimeSeriesPrognosisModel : NamedItem, ISymbolicTimeSeriesPrognosisModel { 37 public override Image ItemImage { 38 get { return HeuristicLab.Common.Resources.VSImageLibrary.Function; } 38 39 } 40 41 #region properties 42 43 [Storable] 44 private ISymbolicExpressionTree symbolicExpressionTree; 45 public ISymbolicExpressionTree SymbolicExpressionTree { 46 get { return symbolicExpressionTree; } 47 } 48 49 [Storable] 50 private ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter; 51 public ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter Interpreter { 52 get { return interpreter; } 53 } 54 55 #endregion 56 57 [Storable] 58 private string[] targetVariables; 59 39 60 40 61 [StorableConstructor] … … 42 63 protected SymbolicTimeSeriesPrognosisModel(SymbolicTimeSeriesPrognosisModel original, Cloner cloner) 43 64 : base(original, cloner) { 65 this.symbolicExpressionTree = cloner.Clone(original.symbolicExpressionTree); 66 this.interpreter = cloner.Clone(original.interpreter); 44 67 } 45 public SymbolicTimeSeriesPrognosisModel(ISymbolicExpressionTree tree, ISymbolicTimeSeriesPrognosisInterpreter interpreter) 46 : base(tree, interpreter) { 68 public SymbolicTimeSeriesPrognosisModel(ISymbolicExpressionTree tree, ISymbolicTimeSeriesPrognosisExpressionTreeInterpreter interpreter, IEnumerable<string> targetVariables) 69 : base() { 70 this.name = ItemName; 71 this.description = ItemDescription; 72 this.symbolicExpressionTree = tree; 73 this.interpreter = interpreter; this.targetVariables = targetVariables.ToArray(); 47 74 } 48 75 … … 52 79 53 80 public IEnumerable<IEnumerable<IEnumerable<double>>> GetPrognosedValues(Dataset dataset, IEnumerable<int> rows, int horizon) { 54 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows, horizon);81 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, targetVariables, rows, horizon); 55 82 } 56 83 … … 68 95 int i = 0; 69 96 int horizon = 1; 70 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, rows, horizon)97 var estimatedValues = model.Interpreter.GetSymbolicExpressionTreeValues(model.SymbolicExpressionTree, dataset, problemData.TargetVariables.ToArray(), rows, horizon) 71 98 .ToArray(); 72 99 foreach (var targetVariable in targetVariables) {
Note: See TracChangeset
for help on using the changeset viewer.