Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12409


Ignore:
Timestamp:
06/01/15 11:09:10 (10 years ago)
Author:
ehopf
Message:

#2361: Merged r12358 into branch.

Location:
branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs

    r12189 r12409  
    2929  [StorableClass]
    3030  public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
    31     private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
    3231    private const string PruningOperatorParameterName = "PruningOperator";
    33     private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
    34       : base(original, cloner) {
     32    public IValueParameter<SymbolicClassificationPruningOperator> PruningOperatorParameter {
     33      get { return (IValueParameter<SymbolicClassificationPruningOperator>)Parameters[PruningOperatorParameterName]; }
    3534    }
    36     public override IDeepCloneable Clone(Cloner cloner) {
    37       return new SymbolicClassificationPruningAnalyzer(this, cloner);
     35
     36    protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator {
     37      get { return PruningOperatorParameter.Value; }
    3838    }
     39
     40    private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner) : base(original, cloner) { }
     41    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningAnalyzer(this, cloner); }
    3942
    4043    [StorableConstructor]
     
    4245
    4346    public SymbolicClassificationPruningAnalyzer() {
    44       Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicClassificationSolutionImpactValuesCalculator()));
    4547      Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
    4648    }
  • branches/SensitivityEvaluator/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs

    r12189 r12409  
    4242    #endregion
    4343
    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); }
    5146
    5247    [StorableConstructor]
     
    6863    protected override double Evaluate(IDataAnalysisModel model) {
    6964      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);
    7267
    73       return Evaluate(classificationModel, classificationProblemData, trainingIndices);
     68      return Evaluate(classificationModel, classificationProblemData, rows);
    7469    }
    7570
     
    10095        impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, quality);
    10196
    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;
    10799
    108100        var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();
Note: See TracChangeset for help on using the changeset viewer.