Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2357 for trunk/sources


Ignore:
Timestamp:
09/15/09 14:07:34 (15 years ago)
Author:
gkronber
Message:

Fixed #740 (SimpleEvaluators in HL.GP.StructId and HL.SVM are not compatible with evaluators in HL.Modeling).

Location:
trunk/sources
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleAccuracyEvaluator.cs

    r2351 r2357  
    5151
    5252      for (int sample = 0; sample < nSamples; sample++) {
    53         double est = values[sample, 0];
    54         double origClass = values[sample, 1];
     53        double est = values[sample, ESTIMATION_INDEX];
     54        double origClass = values[sample, ORIGINAL_INDEX];
    5555        double estClass = double.NaN;
    5656        // if estimation is lower than the smallest threshold value -> estimated class is the lower class
     
    7575      int n = values.GetLength(0);
    7676      double[] original = new double[n];
    77       for (int i = 0; i < n; i++) original[i] = values[i, 1];
     77      for (int i = 0; i < n; i++) original[i] = values[i, ORIGINAL_INDEX];
    7878      return original.OrderBy(x => x).Distinct().ToArray();
    7979    }
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleConfusionMatrixEvaluator.cs

    r2351 r2357  
    2525namespace HeuristicLab.Modeling {
    2626  public class SimpleConfusionMatrixEvaluator : OperatorBase {
     27    protected const int ORIGINAL_INDEX = 0;
     28    protected const int ESTIMATION_INDEX = 1;
    2729    public override string Description {
    2830      get {
     
    5557      int[,] confusionMatrix = new int[classes.Length, classes.Length];
    5658      for (int sample = 0; sample < nSamples; sample++) {
    57         double est = values[sample, 0];
    58         double origClass = values[sample, 1];
     59        double est = values[sample, ESTIMATION_INDEX];
     60        double origClass = values[sample, ORIGINAL_INDEX];
    5961        int estClassIndex = -1;
    6062        // if estimation is lower than the smallest threshold value -> estimated class is the lower class
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleEvaluatorBase.cs

    r2226 r2357  
    99namespace HeuristicLab.Modeling {
    1010  public abstract class SimpleEvaluatorBase : OperatorBase {
     11    protected const int ORIGINAL_INDEX = 0;
     12    protected const int ESTIMATION_INDEX = 1;
     13
    1114    public virtual string OutputVariableName {
    1215      get { return "Quality"; }
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleMSEEvaluator.cs

    r2136 r2357  
    2828      double cnt = 0;
    2929      for (int i = 0; i < values.GetLength(0); i++) {
    30         double estimated = values[i, 0];
    31         double target = values[i, 1];
     30        double estimated = values[i, ESTIMATION_INDEX];
     31        double target = values[i, ORIGINAL_INDEX];
    3232        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
    3333            !double.IsNaN(target) && !double.IsInfinity(target)) {
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleMeanAbsolutePercentageErrorEvaluator.cs

    r2136 r2357  
    5050      int n = 0;
    5151      for (int i = 0; i < values.GetLength(0); i++) {
    52         double estimated = values[i, 0];
    53         double original = values[i, 1];
     52        double estimated = values[i, ESTIMATION_INDEX];
     53        double original = values[i, ORIGINAL_INDEX];
    5454
    5555        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleMeanAbsolutePercentageOfRangeErrorEvaluator.cs

    r2324 r2357  
    5151      // copy to one-dimensional array for range calculation
    5252      double[] originalValues = new double[values.GetLength(0)];
    53       for (int i = 0; i < originalValues.Length; i++) originalValues[i] = values[i, 1];
     53      for (int i = 0; i < originalValues.Length; i++) originalValues[i] = values[i, ORIGINAL_INDEX];
    5454      double range = Statistics.Range(originalValues);
    5555      if (double.IsInfinity(range)) throw new ArgumentException("Range of elements in values is infinity");
     
    5757
    5858      for (int i = 0; i < values.GetLength(0); i++) {
    59         double estimated = values[i, 0];
    60         double original = values[i, 1];
     59        double estimated = values[i, ESTIMATION_INDEX];
     60        double original = values[i, ORIGINAL_INDEX];
    6161
    6262        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleR2Evaluator.cs

    r2136 r2357  
    3030      double cnt = 0;
    3131      for (int i = 0; i < values.GetLength(0); i++) {
    32         double estimated = values[i, 0];
    33         double target = values[i, 1];
     32        double estimated = values[i, ESTIMATION_INDEX];
     33        double target = values[i, ORIGINAL_INDEX];
    3434        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
    3535            !double.IsNaN(target) && !double.IsInfinity(target)) {
     
    4646        double targetDeviationTotalSumOfSquares = 0;
    4747        for (int i = 0; i < values.GetLength(0); i++) {
    48           double target = values[i, 1];
     48          double target = values[i, ORIGINAL_INDEX];
    4949          if (!double.IsNaN(target) && !double.IsInfinity(target)) {
    5050            target = target - targetMean;
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleTheilInequalityCoefficientEvaluator.cs

    r2349 r2357  
    5757      int nSamples = 0;
    5858      for (int sample = 1; sample < n; sample++) {
    59         double prevValue = values[sample - 1, 1];
    60         double estimatedChange = values[sample, 0] - prevValue;
    61         double originalChange = values[sample, 1] - prevValue;
     59        double prevValue = values[sample - 1, ORIGINAL_INDEX];
     60        double estimatedChange = values[sample, ESTIMATION_INDEX] - prevValue;
     61        double originalChange = values[sample, ORIGINAL_INDEX] - prevValue;
    6262        if (!double.IsNaN(originalChange) && !double.IsInfinity(originalChange)) {
    6363          double error = estimatedChange - originalChange;
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleVarianceAccountedForEvaluator.cs

    r2324 r2357  
    5757      double[] originalTargetVariableValues = new double[n];
    5858      for (int i = 0; i < n; i++) {
    59         double estimated = values[i, 0];
    60         double original = values[i, 1];
     59        double estimated = values[i, ESTIMATION_INDEX];
     60        double original = values[i, ORIGINAL_INDEX];
    6161        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
    6262          !double.IsNaN(original) && !double.IsInfinity(original)) {
  • trunk/sources/HeuristicLab.Modeling/3.2/VariableQualityImpactCalculator.cs

    r2319 r2357  
    8787      double[] targetValues = dataset.GetVariableValues(targetVariableName, start, end);
    8888
    89       double oldMSE = CalculateMSE(predictedValues, targetValues);
     89      double oldMSE = CalculateMSE(targetValues, predictedValues);
    9090      double newMSE;
    9191
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorEvaluator.cs

    r2349 r2357  
    6060      double[,] values = new double[scaledProblem.Count, 2];
    6161      for (int i = 0; i < scaledProblem.Count; i++) {
    62         values[i, 0] = SVM.Prediction.Predict(modelData.Model, scaledProblem.X[i]);
    63         values[i, 1] = dataset.GetValue(start + i, targetVariable);
     62        values[i, 0] = dataset.GetValue(start + i, targetVariable);
     63        values[i, 1] = SVM.Prediction.Predict(modelData.Model, scaledProblem.X[i]);
    6464      }
    6565
Note: See TracChangeset for help on using the changeset viewer.