- Timestamp:
- 01/29/14 23:29:50 (11 years ago)
- Location:
- branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 10368,10375,10378,10414,10417,10428
- Property svn:mergeinfo changed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs
r10396 r10429 32 32 private const string NodeImpactThresholdParameterName = "ImpactThreshold"; 33 33 34 private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition"; 35 34 36 private bool reentry; 35 37 [Storable] … … 52 54 get { return (ILookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; } 53 55 } 56 public ILookupParameter<IntRange> FitnessCalculationPartitionParameter { 57 get { return (ILookupParameter<IntRange>)Parameters[FitnessCalculationPartitionParameterName]; } 58 } 54 59 private ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> InterpreterParameter { 55 60 get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[InterpreterParameterName]; } … … 76 81 #region properties 77 82 protected IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } } 83 protected IntRange FitnessCalculationPartition { get { return FitnessCalculationPartitionParameter.ActualValue; } } 78 84 protected ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get { return InterpreterParameter.ActualValue; } } 79 85 protected IntValue UpdateInterval { get { return UpdateIntervalParameter.Value; } } … … 89 95 #endregion 90 96 97 #region IStatefulItem members 98 public override void InitializeState() { 99 base.InitializeState(); 100 UpdateCounter.Value = 0; 101 PrunedSubtrees.Value = 0; 102 PrunedTrees.Value = 0; 103 } 104 public override void ClearState() { 105 base.ClearState(); 106 UpdateCounter.Value = 0; 107 PrunedSubtrees.Value = 0; 108 PrunedTrees.Value = 0; 109 } 110 #endregion 111 91 112 [StorableConstructor] 92 113 protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(bool deserializing) : base(deserializing) { } 114 [StorableHook(HookType.AfterDeserialization)] 115 private void AfterDeserialization() { 116 if (!Parameters.ContainsKey(FitnessCalculationPartitionParameterName)) 117 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "")); 118 } 93 119 protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner) 94 120 : base(original, cloner) { … … 110 136 Parameters.Add(new FixedValueParameter<DoubleValue>(NodeImpactThresholdParameterName, new DoubleValue(0.0))); 111 137 Parameters.Add(new FixedValueParameter<BoolValue>(PruneOnlyZeroImpactNodesParameterName, new BoolValue(false))); 138 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "")); 112 139 } 113 140 … … 147 174 Random = Random, 148 175 PruneOnlyZeroImpactNodes = PruneOnlyZeroImpactNodes.Value, 149 NodeImpactThreshold = NodeImpactThreshold.Value 176 NodeImpactThreshold = NodeImpactThreshold.Value, 177 FitnessCalculationPartition = FitnessCalculationPartition 150 178 }; 151 179 operations.Add(ExecutionContext.CreateChildOperation(op, ExecutionContext.Scope)); -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
r10373 r10429 49 49 private DoubleValue PrunedTrees { get { return NumberOfPrunedTreesParameter.ActualValue; } } 50 50 #endregion 51 52 [StorableConstructor] 53 protected SymbolicDataAnalysisExpressionPruningOperator(bool deserializing) : base(deserializing) { } 51 54 public override IDeepCloneable Clone(Cloner cloner) { 52 55 return new SymbolicDataAnalysisExpressionPruningOperator(this, cloner); 53 56 } 54 pr ivateSymbolicDataAnalysisExpressionPruningOperator(SymbolicDataAnalysisExpressionPruningOperator original, Cloner cloner)57 protected SymbolicDataAnalysisExpressionPruningOperator(SymbolicDataAnalysisExpressionPruningOperator original, Cloner cloner) 55 58 : base(original, cloner) { 56 59 } … … 64 67 public IDataAnalysisProblemData ProblemData { get; set; } 65 68 public ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactsCalculator { get; set; } 69 70 public IntRange FitnessCalculationPartition { get; set; } 66 71 public IRandom Random { get; set; } 67 72 … … 73 78 74 79 var nodes = Model.SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); 80 var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size).ToList(); 75 81 76 82 for (int j = 0; j < nodes.Count; ++j) { … … 78 84 if (node is ConstantTreeNode) continue; 79 85 80 var impact = ImpactsCalculator.CalculateImpactValue(Model, node, ProblemData, ProblemData.TrainingIndices);86 var impact = ImpactsCalculator.CalculateImpactValue(Model, node, ProblemData, rows); 81 87 82 88 if (PruneOnlyZeroImpactNodes) { … … 86 92 } 87 93 88 var replacementValue = ImpactsCalculator.CalculateReplacementValue(Model, node, ProblemData, ProblemData.TrainingIndices);94 var replacementValue = ImpactsCalculator.CalculateReplacementValue(Model, node, ProblemData, rows); 89 95 var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue }; 90 96 ReplaceWithConstant(node, constantNode);
Note: See TracChangeset
for help on using the changeset viewer.