Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8126


Ignore:
Timestamp:
06/26/12 15:29:45 (12 years ago)
Author:
gkronber
Message:

#1823 fixed a bug in the Pareto-best solution analyzers for symbolic data analysis. Fixed a minor bug in the calculation of classification thresholds, made a sneaky change in SymbolicExpressionTree

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTree.cs

    r7795 r8126  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Linq;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    7778    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth() {
    7879      if (root == null)
    79         return new SymbolicExpressionTreeNode[0];
     80        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    8081      return root.IterateNodesBreadth();
    8182    }
     
    8384    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix() {
    8485      if (root == null)
    85         return new SymbolicExpressionTreeNode[0];
     86        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    8687      return root.IterateNodesPrefix();
    8788    }
    8889    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPostfix() {
    8990      if (root == null)
    90         return new SymbolicExpressionTreeNode[0];
     91        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    9192      return root.IterateNodesPostfix();
    9293    }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs

    r7734 r8126  
    100100
    101101      List<double> complexities;
    102       if (ComplexityParameter.ActualValue != null) {
     102      if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == qualities.Count) {
    103103        complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList();
    104104      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer.cs

    r7734 r8126  
    137137
    138138      List<double> complexities;
    139       if (ComplexityParameter.ActualValue != null) {
     139      if (ComplexityParameter.ActualValue != null && ComplexityParameter.ActualValue.Length == trainingQuality.Length) {
    140140        complexities = ComplexityParameter.ActualValue.Select(x => x.Value).ToList();
    141141      } else {
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ThresholdCalculators/AccuracyMaximizationThresholdCalculator.cs

    r7259 r8126  
    5454    public static void CalculateThresholds(IClassificationProblemData problemData, IEnumerable<double> estimatedValues, IEnumerable<double> targetClassValues, out double[] classValues, out double[] thresholds) {
    5555      int slices = 100;
     56      double minThresholdInc = 10e-5; // necessary to prevent infinite loop when maxEstimated - minEstimated is effectively zero (constant model)
    5657      List<double> estimatedValuesList = estimatedValues.ToList();
    5758      double maxEstimatedValue = estimatedValuesList.Max();
    5859      double minEstimatedValue = estimatedValuesList.Min();
    59       double thresholdIncrement = (maxEstimatedValue - minEstimatedValue) / slices;
     60      double thresholdIncrement = Math.Max((maxEstimatedValue - minEstimatedValue) / slices, minThresholdInc);
    6061      var estimatedAndTargetValuePairs =
    6162        estimatedValuesList.Zip(targetClassValues, (x, y) => new { EstimatedValue = x, TargetClassValue = y })
     
    7071
    7172      // incrementally calculate accuracy of all possible thresholds
    72       int[,] confusionMatrix = new int[nClasses, nClasses];
    73 
    7473      for (int i = 1; i < thresholds.Length; i++) {
    7574        double lowerThreshold = thresholds[i - 1];
Note: See TracChangeset for help on using the changeset viewer.