- Timestamp:
- 01/25/11 16:51:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs
r5287 r5373 26 26 using HeuristicLab.Common; 27 27 using HeuristicLab.Core; 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 30 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols; … … 76 77 77 78 protected override void RecalculateEstimatedValues() { 78 int minLag = 0; 79 var laggedTreeNodes = Model.SymbolicExpressionTree.IterateNodesPrefix().OfType<LaggedVariableTreeNode>(); 80 if (laggedTreeNodes.Any()) 81 minLag = laggedTreeNodes.Min(node => node.Lag); 79 int minLag = GetMinimumLagFromTree(Model.SymbolicExpressionTree.Root); 82 80 IEnumerable<double> calculatedValues = 83 81 from x in Model.GetEstimatedValues(ProblemData, 0 - minLag, ProblemData.Dataset.Rows) … … 93 91 yield return estimatedValues[row]; 94 92 } 93 94 protected int GetMinimumLagFromTree(SymbolicExpressionTreeNode node) { 95 if (node == null) return 0; 96 int lag = 0; 97 98 var laggedTreeNode = node as ILaggedTreeNode; 99 if (laggedTreeNode != null) lag += laggedTreeNode.Lag; 100 if (node.Symbol is Derivative) lag -= 4; 101 102 int subtreeLag = 0; 103 foreach (var subtree in node.SubTrees) { 104 subtreeLag = Math.Min(subtreeLag, GetMinimumLagFromTree(subtree)); 105 } 106 return lag + subtreeLag; 107 } 95 108 } 96 109 }
Note: See TracChangeset
for help on using the changeset viewer.