Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12487


Ignore:
Timestamp:
06/22/15 16:55:29 (9 years ago)
Author:
ehopf
Message:

#2361: Fixed a bug that causes an exception when a ModelCreator is used that doesn´t implement the ISymbolicDiscriminantFunctionClassificationModelCreator interface. Note that the runtime can be further improved for those ModelCreators because of redundant calculations.

File:
1 edited

Legend:

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

    r12418 r12487  
    119119
    120120      //calculate performance measures
    121       var model = (ISymbolicDiscriminantFunctionClassificationModel)modelCreator.CreateSymbolicClassificationModel(solution, interpreter, lowerEstimationLimit, upperEstimationLimit);
    122121      string positiveClassName = problemData.PositiveClass;
    123122      double[] classValues, thresholds;
    124       model.ThresholdCalculator.Calculate(problemData, boundedEstimatedValues, targetClassValues, out classValues, out thresholds);
    125       model.SetThresholdsAndClassValues(thresholds, classValues);
     123      IEnumerable<double> estimatedClassValues = null;
     124      ISymbolicDiscriminantFunctionClassificationModel m;
     125
     126      var model = modelCreator.CreateSymbolicClassificationModel(solution, interpreter, lowerEstimationLimit, upperEstimationLimit);
     127      if ((m = model as ISymbolicDiscriminantFunctionClassificationModel) != null) {
     128        m.ThresholdCalculator.Calculate(problemData, boundedEstimatedValues, targetClassValues, out classValues, out thresholds);
     129        m.SetThresholdsAndClassValues(thresholds, classValues);
     130        estimatedClassValues = m.GetEstimatedClassValues(boundedEstimatedValues);
     131      } else {
     132        model.RecalculateModelParameters(problemData, rows);
     133        estimatedClassValues = model.GetEstimatedClassValues(problemData.Dataset, rows);
     134      }
    126135      var performanceCalculator = new ClassificationPerformanceMeasuresCalculator(positiveClassName, problemData.GetClassValue(positiveClassName));
    127       var estimatedClassValues = model.GetEstimatedClassValues(boundedEstimatedValues);
    128136      performanceCalculator.Calculate(targetClassValues, estimatedClassValues);
    129137      if (performanceCalculator.ErrorState != OnlineCalculatorError.None)
Note: See TracChangeset for help on using the changeset viewer.