Changeset 12361 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
- Timestamp:
- 04/29/15 15:19:58 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
r12359 r12361 41 41 private const string PrunedSubtreesParameterName = "PrunedSubtrees"; 42 42 private const string PrunedTreesParameterName = "PrunedTrees"; 43 private const string PrunedNodesParameterName = "PrunedNodes"; 43 44 private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition"; 44 45 private const string NodeImpactThresholdParameterName = "ImpactThreshold"; … … 71 72 public ILookupParameter<IntValue> PrunedTreesParameter { 72 73 get { return (ILookupParameter<IntValue>)Parameters[PrunedTreesParameterName]; } 74 } 75 public ILookupParameter<IntValue> PrunedNodesParameter { 76 get { return (ILookupParameter<IntValue>)Parameters[PrunedNodesParameterName]; } 73 77 } 74 78 public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter { … … 111 115 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisModel>(SymbolicDataAnalysisModelParameterName)); 112 116 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName)); 117 Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned.")); 113 118 Parameters.Add(new LookupParameter<IntValue>(PrunedSubtreesParameterName, "A counter of how many subtrees were replaced.")); 114 119 Parameters.Add(new LookupParameter<IntValue>(PrunedTreesParameterName, "A counter of how many trees were pruned.")); … … 139 144 var prunedSubtrees = 0; 140 145 var prunedTrees = 0; 146 var prunedNodes = 0; 141 147 142 148 double quality = Evaluate(model); … … 155 161 constantNode.Value = replacementValue; 156 162 163 var length = node.GetLength(); 157 164 ReplaceWithConstant(node, constantNode); 158 i += node.GetLength()- 1; // skip subtrees under the node that was folded165 i += length - 1; // skip subtrees under the node that was folded 159 166 160 167 quality -= impactValue; 161 168 prunedSubtrees++; 169 prunedNodes += length; 162 170 } 163 171 … … 165 173 PrunedSubtreesParameter.ActualValue = new IntValue(prunedSubtrees); 166 174 PrunedTreesParameter.ActualValue = new IntValue(prunedTrees); 175 PrunedNodesParameter.ActualValue = new IntValue(prunedNodes); 167 176 QualityParameter.ActualValue.Value = quality; 168 177
Note: See TracChangeset
for help on using the changeset viewer.