Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/08/14 19:29:00 (10 years ago)
Author:
mkommend
Message:

#2143: Merged r10368, r10375, r10378, r10414, r10417, r10418, r10428, r10469, r10470, r11013, r11025, r11026, r11027 into stable.

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • stable/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs

    r10281 r11145  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
     25using HeuristicLab.Core;
    2426using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2528
    2629namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     30  [StorableClass]
     31  [Item("SymbolicClassificationSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for classification problems.")]
    2732  public class SymbolicClassificationSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator {
     33    public SymbolicClassificationSolutionImpactValuesCalculator() { }
     34    protected SymbolicClassificationSolutionImpactValuesCalculator(SymbolicClassificationSolutionImpactValuesCalculator original, Cloner cloner)
     35      : base(original, cloner) { }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new SymbolicClassificationSolutionImpactValuesCalculator(this, cloner);
     38    }
     39    [StorableConstructor]
     40    protected SymbolicClassificationSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { }
     41
    2842    public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
    2943      var classificationModel = (ISymbolicClassificationModel)model;
     
    3448
    3549    public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) {
     50      double impactValue, replacementValue;
     51      CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality);
     52      return impactValue;
     53    }
     54
     55    public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node,
     56      IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue,
     57      double originalQuality = Double.NaN) {
    3658      var classificationModel = (ISymbolicClassificationModel)model;
    3759      var classificationProblemData = (IClassificationProblemData)problemData;
     
    4769      }
    4870
    49       var replacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows);
     71      replacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows);
    5072      var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
    5173
     
    6385      if (errorState != OnlineCalculatorError.None) newQuality = 0.0;
    6486
    65       return originalQuality - newQuality;
     87      impactValue = originalQuality - newQuality;
    6688    }
    67 
    6889  }
    6990}
Note: See TracChangeset for help on using the changeset viewer.