Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/27/10 14:36:27 (14 years ago)
Author:
gkronber
Message:

Fixed some bugs in multi-variate regression classes. #1089

Location:
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionNormalizedMeanSquaredErrorEvaluator.cs

    r4068 r4112  
    6565
    6666    public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    67       int targetVariableIndex = dataset.GetVariableIndex(targetVariable);
    68       var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows);
    69       var originalValues = dataset.GetEnumeratedVariableValues(targetVariableIndex, rows);
    70       IEnumerator<double> originalEnumerator = originalValues.GetEnumerator();
    71       IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator();
    72       OnlineNormalizedMeanSquaredErrorEvaluator mseEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator();
    73 
    74       while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) {
    75         double estimated = estimatedEnumerator.Current;
    76         double original = originalEnumerator.Current;
    77         if (double.IsNaN(estimated))
    78           estimated = upperEstimationLimit;
    79         else
    80           estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated));
    81         mseEvaluator.Add(original, estimated);
    82       }
    83 
    84       if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext()) {
    85         throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match.");
    86       } else {
    87         return mseEvaluator.NormalizedMeanSquaredError;
    88       }
     67      return SymbolicRegressionScaledNormalizedMeanSquaredErrorEvaluator.CalculateWithScaling(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows, 1.0, 0.0);
    8968    }
    9069  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionNormalizedMseEvaluator.cs

    r4068 r4112  
    7373        tree.Root.SubTrees[0].AddSubTree(treeNode);
    7474      }
    75       return nmseSum / targetVariablesList.Count;
     75      return nmseSum;
    7676    }
    7777  }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledMseEvaluator.cs

    r4068 r4112  
    7575        double mse = SymbolicRegressionScaledMeanSquaredErrorEvaluator.Calculate(interpreter, tree,
    7676          lowerEstimationBound[i], upperEstimationBound[i],
    77           problemData.Dataset, targetVariablesList[i], rows, out compAlpha, out compBeta);
     77          problemData.Dataset, targetVariablesList[i], rows, out compBeta, out compAlpha);
    7878
    7979        qualities[i] = mse;
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledNormalizedMseEvaluator.cs

    r4087 r4112  
    8787      AlphaParameter.ActualValue = alpha;
    8888      BetaParameter.ActualValue = beta;
    89       QualityParameter.ActualValue = new DoubleValue(nmseSum / targetVariables.Count());
     89      QualityParameter.ActualValue = new DoubleValue(nmseSum);
    9090    }
    9191  }
Note: See TracChangeset for help on using the changeset viewer.