Changeset 12378 for branches/GBT
- Timestamp:
- 05/04/15 13:08:49 (10 years ago)
- Location:
- branches/GBT
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GBT
- Property svn:mergeinfo changed
/trunk/sources (added) merged: 12333,12358-12361,12365
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Core
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Core (added) merged: 12360
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Core/3.3/Collections/DirectedGraph/Vertex.cs
r12012 r12378 35 35 get { return label; } 36 36 set { 37 if ( label.Equals(value)) return;37 if (String.Equals(Label, value)) return; 38 38 label = value; 39 39 OnChanged(this, EventArgs.Empty); -
branches/GBT/HeuristicLab.Encodings.BinaryVectorEncoding
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Encodings.BinaryVectorEncoding (added) merged: 12333
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Encodings.BinaryVectorEncoding/3.3/Creators/RandomBinaryVectorCreator.cs
r12012 r12378 34 34 [StorableClass] 35 35 public sealed class RandomBinaryVectorCreator : BinaryVectorCreator { 36 private const string TrueProbabilityParameterName = "TruePro pability";36 private const string TrueProbabilityParameterName = "TrueProbability"; 37 37 38 38 private IValueLookupParameter<DoubleValue> TrueProbabilityParameter { … … 59 59 #region Backwards compatible code, remove with 3.4 60 60 var defaultValue = 0.5; 61 if (Parameters.ContainsKey(TrueProbabilityParameterName) && Parameters[TrueProbabilityParameterName] is IFixedValueParameter<DoubleValue>) { 62 defaultValue = ((IFixedValueParameter<DoubleValue>)Parameters[TrueProbabilityParameterName]).Value.Value; 63 Parameters.Remove(TrueProbabilityParameterName); 61 const string parameterNameWithTypo = "TruePropability"; 62 if (Parameters.ContainsKey(parameterNameWithTypo) && Parameters[parameterNameWithTypo] is IValueParameter<DoubleValue>) { 63 defaultValue = ((IValueParameter<DoubleValue>)Parameters[parameterNameWithTypo]).Value.Value; 64 Parameters.Remove(parameterNameWithTypo); 64 65 } 65 66 if (!Parameters.ContainsKey(TrueProbabilityParameterName)) -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic (added) merged: 12358-12359,12361
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification (added) merged: 12358
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs
r12189 r12378 29 29 [StorableClass] 30 30 public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer { 31 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";32 31 private const string PruningOperatorParameterName = "PruningOperator"; 33 p rivate SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)34 : base(original, cloner) {32 public IValueParameter<SymbolicClassificationPruningOperator> PruningOperatorParameter { 33 get { return (IValueParameter<SymbolicClassificationPruningOperator>)Parameters[PruningOperatorParameterName]; } 35 34 } 36 public override IDeepCloneable Clone(Cloner cloner) { 37 return new SymbolicClassificationPruningAnalyzer(this, cloner); 35 36 protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator { 37 get { return PruningOperatorParameter.Value; } 38 38 } 39 40 private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner) : base(original, cloner) { } 41 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningAnalyzer(this, cloner); } 39 42 40 43 [StorableConstructor] … … 42 45 43 46 public SymbolicClassificationPruningAnalyzer() { 44 Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicClassificationSolutionImpactValuesCalculator()));45 47 Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator()))); 46 48 } -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs
r12189 r12378 42 42 #endregion 43 43 44 protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator original, Cloner cloner) 45 : base(original, cloner) { 46 } 47 48 public override IDeepCloneable Clone(Cloner cloner) { 49 return new SymbolicClassificationPruningOperator(this, cloner); 50 } 44 protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator original, Cloner cloner) : base(original, cloner) { } 45 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningOperator(this, cloner); } 51 46 52 47 [StorableConstructor] … … 68 63 protected override double Evaluate(IDataAnalysisModel model) { 69 64 var classificationModel = (IClassificationModel)model; 70 var classificationProblemData = (IClassificationProblemData)ProblemData ;71 var trainingIndices = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);65 var classificationProblemData = (IClassificationProblemData)ProblemDataParameter.ActualValue; 66 var rows = Enumerable.Range(FitnessCalculationPartitionParameter.ActualValue.Start, FitnessCalculationPartitionParameter.ActualValue.Size); 72 67 73 return Evaluate(classificationModel, classificationProblemData, trainingIndices);68 return Evaluate(classificationModel, classificationProblemData, rows); 74 69 } 75 70 … … 100 95 impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality); 101 96 102 if (pruneOnlyZeroImpactNodes) { 103 if (!impactValue.IsAlmost(0.0)) continue; 104 } else if (nodeImpactThreshold < impactValue) { 105 continue; 106 } 97 if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue; 98 if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue; 107 99 108 100 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode(); -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression (added) merged: 12358
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningAnalyzer.cs
r12189 r12378 31 31 [StorableClass] 32 32 public sealed class SymbolicRegressionPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer { 33 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";34 33 private const string PruningOperatorParameterName = "PruningOperator"; 35 p rivate SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner)36 : base(original, cloner) {34 public IValueParameter<SymbolicRegressionPruningOperator> PruningOperatorParameter { 35 get { return (IValueParameter<SymbolicRegressionPruningOperator>)Parameters[PruningOperatorParameterName]; } 37 36 } 38 public override IDeepCloneable Clone(Cloner cloner) { 39 return new SymbolicRegressionPruningAnalyzer(this, cloner); 37 38 protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator { 39 get { return PruningOperatorParameter.Value; } 40 40 } 41 42 private SymbolicRegressionPruningAnalyzer(SymbolicRegressionPruningAnalyzer original, Cloner cloner) : base(original, cloner) { } 43 public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicRegressionPruningAnalyzer(this, cloner); } 41 44 42 45 [StorableConstructor] … … 44 47 45 48 public SymbolicRegressionPruningAnalyzer() { 46 Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicRegressionSolutionImpactValuesCalculator())); 47 Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 49 Parameters.Add(new ValueParameter<SymbolicRegressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicRegressionPruningOperator(new SymbolicRegressionSolutionImpactValuesCalculator()))); 48 50 } 49 51 } -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SymbolicRegressionPruningOperator.cs
r12189 r12378 53 53 protected override double Evaluate(IDataAnalysisModel model) { 54 54 var regressionModel = (IRegressionModel)model; 55 var regressionProblemData = (IRegressionProblemData)ProblemData ;56 var rows = Enumerable.Range(FitnessCalculationPartition .Start, FitnessCalculationPartition.Size);55 var regressionProblemData = (IRegressionProblemData)ProblemDataParameter.ActualValue; 56 var rows = Enumerable.Range(FitnessCalculationPartitionParameter.ActualValue.Start, FitnessCalculationPartitionParameter.ActualValue.Size); 57 57 return Evaluate(regressionModel, regressionProblemData, rows); 58 58 } … … 81 81 impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality); 82 82 83 if (pruneOnlyZeroImpactNodes) { 84 if (!impactValue.IsAlmost(0.0)) continue; 85 } else if (nodeImpactThreshold < impactValue) { 86 continue; 87 } 83 if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue; 84 if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue; 88 85 89 86 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode(); -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs
r12012 r12378 45 45 private const string TotalNumberOfPrunedSubtreesParameterName = "Number of pruned subtrees"; 46 46 private const string TotalNumberOfPrunedTreesParameterName = "Number of pruned trees"; 47 private const string TotalNumberOfPrunedNodesParameterName = "Number of pruned nodes"; 47 48 private const string RandomParameterName = "Random"; 48 private const string PruneOnlyZeroImpactNodesParameterName = "PruneOnlyZeroImpactNodes";49 private const string NodeImpactThresholdParameterName = "ImpactThreshold";50 private const string PruningOperatorParameterName = "PruningOperator";51 49 private const string ResultsParameterName = "Results"; 52 50 private const string PopulationSizeParameterName = "PopulationSize"; … … 54 52 55 53 #region private members 54 private DataReducer prunedNodesReducer; 56 55 private DataReducer prunedSubtreesReducer; 57 56 private DataReducer prunedTreesReducer; … … 61 60 62 61 #region parameter properties 63 public IValueParameter<SymbolicDataAnalysisExpressionPruningOperator> PruningOperatorParameter {64 get { return (IValueParameter<SymbolicDataAnalysisExpressionPruningOperator>)Parameters[PruningOperatorParameterName]; }65 }66 public IFixedValueParameter<BoolValue> PruneOnlyZeroImpactNodesParameter {67 get { return (IFixedValueParameter<BoolValue>)Parameters[PruneOnlyZeroImpactNodesParameterName]; }68 }69 public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter {70 get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; }71 }72 62 public ILookupParameter<IRandom> RandomParameter { 73 63 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; } … … 91 81 92 82 #region properties 93 protected SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get { return PruningOperatorParameter.Value; }}83 protected abstract SymbolicDataAnalysisExpressionPruningOperator PruningOperator { get; } 94 84 protected int UpdateInterval { get { return UpdateIntervalParameter.Value.Value; } } 95 85 … … 112 102 get { return PruningProbabilityParameter.Value.Value; } 113 103 set { PruningProbabilityParameter.Value.Value = value; } 114 }115 116 protected bool PruneOnlyZeroImpactNodes {117 get { return PruneOnlyZeroImpactNodesParameter.Value.Value; }118 set { PruneOnlyZeroImpactNodesParameter.Value.Value = value; }119 }120 protected double NodeImpactThreshold {121 get { return NodeImpactThresholdParameter.Value.Value; }122 set { NodeImpactThresholdParameter.Value.Value = value; }123 104 } 124 105 #endregion … … 140 121 protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner) 141 122 : base(original, cloner) { 123 if (original.prunedNodesReducer != null) 124 this.prunedNodesReducer = (DataReducer)original.prunedNodesReducer.Clone(); 142 125 if (original.prunedSubtreesReducer != null) 143 126 this.prunedSubtreesReducer = (DataReducer)original.prunedSubtreesReducer.Clone(); … … 197 180 Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The random number generator.")); 198 181 Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The problem data.")); 199 Parameters.Add(new FixedValueParameter<DoubleValue>(NodeImpactThresholdParameterName, "The impact threshold below which an individual should be pruned.", new DoubleValue(0.0)));200 Parameters.Add(new FixedValueParameter<BoolValue>(PruneOnlyZeroImpactNodesParameterName, "Switch to determine of only zero impact individuals should be pruned.", new BoolValue(false)));201 182 Parameters.Add(new LookupParameter<IntValue>(PopulationSizeParameterName, "The population of individuals.")); 202 183 #endregion … … 250 231 UpdateCounter = 0; 251 232 252 if (pruned SubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); }233 if (prunedNodesReducer == null || prunedSubtreesReducer == null || prunedTreesReducer == null || valuesCollector == null || resultsCollector == null) { InitializeOperators(); } 253 234 254 235 var prune = CreatePruningOperation(); 236 var reducePrunedNodes = ExecutionContext.CreateChildOperation(prunedNodesReducer); 255 237 var reducePrunedSubtrees = ExecutionContext.CreateChildOperation(prunedSubtreesReducer); 256 238 var reducePrunedTrees = ExecutionContext.CreateChildOperation(prunedTreesReducer); … … 258 240 var collectResults = ExecutionContext.CreateChildOperation(resultsCollector); 259 241 260 return new OperationCollection { prune, reducePruned Subtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() };242 return new OperationCollection { prune, reducePrunedNodes, reducePrunedSubtrees, reducePrunedTrees, collectValues, collectResults, base.Apply() }; 261 243 } 262 244 263 245 private void InitializeOperators() { 246 prunedNodesReducer = new DataReducer(); 247 prunedNodesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedNodesParameter.ActualName; 248 prunedNodesReducer.ReductionOperation.Value = new ReductionOperation(ReductionOperations.Sum); // sum all the pruned subtrees parameter values 249 prunedNodesReducer.TargetOperation.Value = new ReductionOperation(ReductionOperations.Assign); // asign the sum to the target parameter 250 prunedNodesReducer.TargetParameter.ActualName = TotalNumberOfPrunedNodesParameterName; 251 264 252 prunedSubtreesReducer = new DataReducer(); 265 253 prunedSubtreesReducer.ParameterToReduce.ActualName = PruningOperator.PrunedSubtreesParameter.ActualName; … … 275 263 276 264 valuesCollector = new DataTableValuesCollector(); 265 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedNodesParameterName)); 277 266 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedSubtreesParameterName)); 278 267 valuesCollector.CollectedValues.Add(new LookupParameter<IntValue>(TotalNumberOfPrunedTreesParameterName)); -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisExpressionPruningOperator.cs
r12189 r12378 34 34 [StorableClass] 35 35 [Item("SymbolicExpressionTreePruningOperator", "An operator that replaces introns with constant values in a symbolic expression tree.")] 36 public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator {36 public abstract class SymbolicDataAnalysisExpressionPruningOperator : SingleSuccessorOperator, ISymbolicExpressionTreeOperator { 37 37 #region parameter names 38 38 private const string ProblemDataParameterName = "ProblemData"; … … 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"; … … 72 73 get { return (ILookupParameter<IntValue>)Parameters[PrunedTreesParameterName]; } 73 74 } 75 public ILookupParameter<IntValue> PrunedNodesParameter { 76 get { return (ILookupParameter<IntValue>)Parameters[PrunedNodesParameterName]; } 77 } 74 78 public IFixedValueParameter<DoubleValue> NodeImpactThresholdParameter { 75 79 get { return (IFixedValueParameter<DoubleValue>)Parameters[NodeImpactThresholdParameterName]; } … … 87 91 88 92 #region properties 89 protected IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } } 90 protected ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator { get { return ImpactValuesCalculatorParameter.Value; } } 91 protected IntRange FitnessCalculationPartition { get { return FitnessCalculationPartitionParameter.ActualValue; } } 92 protected bool PruneOnlyZeroImpactNodes { 93 public ISymbolicDataAnalysisSolutionImpactValuesCalculator ImpactValuesCalculator { 94 get { return ImpactValuesCalculatorParameter.Value; } 95 set { ImpactValuesCalculatorParameter.Value = value; } 96 } 97 public bool PruneOnlyZeroImpactNodes { 93 98 get { return PruneOnlyZeroImpactNodesParameter.Value.Value; } 94 99 set { PruneOnlyZeroImpactNodesParameter.Value.Value = value; } 95 100 } 96 p rotecteddouble NodeImpactThreshold {101 public double NodeImpactThreshold { 97 102 get { return NodeImpactThresholdParameter.Value.Value; } 98 103 set { NodeImpactThresholdParameter.Value.Value = value; } 99 104 } 100 protected ISymbolicExpressionTree SymbolicExpressionTree { get { return SymbolicExpressionTreeParameter.ActualValue; } }101 protected DoubleValue Quality { get { return QualityParameter.ActualValue; } }102 protected DoubleLimit EstimationLimits { get { return EstimationLimitsParameter.ActualValue; } }103 protected ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get { return InterpreterParameter.ActualValue; } }104 105 #endregion 105 106 … … 114 115 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisModel>(SymbolicDataAnalysisModelParameterName)); 115 116 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName)); 117 Parameters.Add(new LookupParameter<IntValue>(PrunedNodesParameterName, "A counter of how many nodes were pruned.")); 116 118 Parameters.Add(new LookupParameter<IntValue>(PrunedSubtreesParameterName, "A counter of how many subtrees were replaced.")); 117 119 Parameters.Add(new LookupParameter<IntValue>(PrunedTreesParameterName, "A counter of how many trees were pruned.")); … … 131 133 132 134 public override IOperation Apply() { 133 var model = CreateModel(SymbolicExpressionTree, Interpreter, ProblemData, EstimationLimits); 134 var nodes = SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); 135 var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size); 135 var tree = SymbolicExpressionTreeParameter.ActualValue; 136 var problemData = ProblemDataParameter.ActualValue; 137 var fitnessCalculationPartition = FitnessCalculationPartitionParameter.ActualValue; 138 var estimationLimits = EstimationLimitsParameter.ActualValue; 139 var interpreter = InterpreterParameter.ActualValue; 140 141 var model = CreateModel(tree, interpreter, problemData, estimationLimits); 142 var nodes = tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList(); 143 var rows = Enumerable.Range(fitnessCalculationPartition.Start, fitnessCalculationPartition.Size); 136 144 var prunedSubtrees = 0; 137 145 var prunedTrees = 0; 146 var prunedNodes = 0; 138 147 139 148 double quality = Evaluate(model); … … 144 153 145 154 double impactValue, replacementValue; 146 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, ProblemData, rows, out impactValue, out replacementValue, quality);155 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality); 147 156 148 if (PruneOnlyZeroImpactNodes) { 149 if (!impactValue.IsAlmost(0.0)) continue; 150 } else if (NodeImpactThreshold < impactValue) { 151 continue; 152 } 157 if (PruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue; 158 if (!PruneOnlyZeroImpactNodes && impactValue > NodeImpactThreshold) continue; 153 159 154 160 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode(); 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 162 168 prunedSubtrees++; 169 prunedNodes += length; 163 170 } 164 171 … … 166 173 PrunedSubtreesParameter.ActualValue = new IntValue(prunedSubtrees); 167 174 PrunedTreesParameter.ActualValue = new IntValue(prunedTrees); 175 PrunedNodesParameter.ActualValue = new IntValue(prunedNodes); 176 QualityParameter.ActualValue.Value = quality; 168 177 169 178 return base.Apply(); 170 }171 172 public ISymbolicExpressionTree Prune(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) {173 var model = CreateModel((ISymbolicExpressionTree)tree.Clone(), Interpreter, ProblemData, EstimationLimits);174 var nodes = SymbolicExpressionTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();175 var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);176 177 double quality = Evaluate(model);178 179 for (int i = 0; i < nodes.Count; ++i) {180 var node = nodes[i];181 if (node is ConstantTreeNode) continue;182 183 double impactValue, replacementValue;184 ImpactValuesCalculator.CalculateImpactAndReplacementValues(model, node, ProblemData, rows, out impactValue, out replacementValue, quality);185 186 if (PruneOnlyZeroImpactNodes) {187 if (!impactValue.IsAlmost(0.0)) continue;188 } else if (NodeImpactThreshold < impactValue) {189 continue;190 }191 192 var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();193 constantNode.Value = replacementValue;194 195 ReplaceWithConstant(node, constantNode);196 i += node.GetLength() - 1; // skip subtrees under the node that was folded197 198 quality -= impactValue;199 }200 return model.SymbolicExpressionTree;201 179 } 202 180 -
branches/GBT/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis.Views (added) merged: 12365
- Property svn:mergeinfo changed
-
branches/GBT/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs
r12012 r12378 48 48 chart.ChartAreas[0].AxisX.Title = "Absolute Error"; 49 49 chart.ChartAreas[0].AxisX.Minimum = 0.0; 50 chart.ChartAreas[0].AxisX.Maximum = 1.0;50 chart.ChartAreas[0].AxisX.Maximum = 0.0; 51 51 chart.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount; 52 52 chart.ChartAreas[0].CursorX.Interval = 0.01; … … 118 118 solutionSeries.ChartType = SeriesChartType.FastLine; 119 119 var residuals = GetResiduals(GetOriginalValues(), GetEstimatedValues(solution)); 120 121 chart.ChartAreas[0].AxisX.Maximum = Math.Ceiling(residuals.Max()); 120 121 122 var maxValue = residuals.Max(); 123 if (maxValue >= chart.ChartAreas[0].AxisX.Maximum) { 124 double scale = Math.Pow(10, Math.Floor(Math.Log10(maxValue))); 125 var maximum = scale * (1 + (int)(maxValue / scale)); 126 chart.ChartAreas[0].AxisX.Maximum = maximum; 127 } 122 128 chart.ChartAreas[0].CursorX.Interval = residuals.Min() / 100; 123 129
Note: See TracChangeset
for help on using the changeset viewer.