- Timestamp:
- 04/29/15 11:56:50 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs
r12189 r12358 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 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs
r12189 r12358 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();
Note: See TracChangeset
for help on using the changeset viewer.