Changeset 5076 for branches/GP.Symbols (TimeLag, Diff, Integral)
- Timestamp:
- 12/09/10 10:45:36 (14 years ago)
- Location:
- branches/GP.Symbols (TimeLag, Diff, Integral)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionConditionalPearsonsRSquaredEvaluator.cs
r5074 r5076 23 23 using System; 24 24 using System.Collections.Generic; 25 using System.Linq;26 25 using HeuristicLab.Common; 27 26 using HeuristicLab.Core; … … 32 31 using HeuristicLab.Problems.DataAnalysis.Evaluators; 33 32 using HeuristicLab.Problems.DataAnalysis.Symbolic; 34 using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;35 33 36 34 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Evaluators { … … 73 71 OnlinePearsonsRSquaredEvaluator r2Evaluator = new OnlinePearsonsRSquaredEvaluator(); 74 72 75 int minLag = 0; 76 var laggedTreeNodes = solution.IterateNodesPrefix().OfType<LaggedVariableTreeNode>(); 77 if (laggedTreeNodes.Any()) 78 minLag = laggedTreeNodes.Min(laggedTreeNode => laggedTreeNode.Symbol.MinLag); 73 int minLag = GetMinimumLagFromTree(solution.Root); 79 74 80 75 while (originalEnumerator.MoveNext() && estimatedEnumerator.MoveNext() && rowsEnumerator.MoveNext()) { … … 88 83 } 89 84 90 if (evaluate) 91 if (dataset[conditionVariable, row].IsAlmost(0.0) && dataset[conditionVariable, row - 1].IsAlmost(0.0)) { 92 if (double.IsNaN(estimated)) 93 estimated = upperEstimationLimit; 94 else 95 estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated)); 96 r2Evaluator.Add(original, estimated); 97 } 85 if (evaluate) { 86 if (double.IsNaN(estimated)) 87 estimated = upperEstimationLimit; 88 else 89 estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated)); 90 r2Evaluator.Add(original, estimated); 91 } 98 92 } 99 93 100 94 if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext() || rowsEnumerator.MoveNext()) { 101 95 throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match."); 102 } else { 103 return r2Evaluator.RSquared; 96 } else return r2Evaluator.RSquared; 97 } 98 99 protected static int GetMinimumLagFromTree(SymbolicExpressionTreeNode node) { 100 if (node == null) return 0; 101 int lag = 0; 102 103 var laggedTreeNode = node as ILaggedTreeNode; 104 if (laggedTreeNode != null) lag += laggedTreeNode.Lag; 105 106 int subtreeLag = 0; 107 foreach (var subtree in node.SubTrees) { 108 subtreeLag = Math.Min(subtreeLag, GetMinimumLagFromTree(subtree)); 104 109 } 110 return lag + subtreeLag; 105 111 } 106 112 -
branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/VariableCondition.cs
r5060 r5076 144 144 #region persistence and cloning 145 145 [StorableConstructor] 146 protected VariableCondition(bool deserializing) : base(deserializing) { } 146 protected VariableCondition(bool deserializing) 147 : base(deserializing) { 148 variableNames = new List<string>(); 149 } 147 150 protected VariableCondition(VariableCondition original, Cloner cloner) 148 151 : base(original, cloner) {
Note: See TracChangeset
for help on using the changeset viewer.