Ignore:
Timestamp:
07/09/10 17:01:36 (11 years ago)
Author:
gkronber
Message:

Worked on symbolic regression classes to prepare for time series prognosis plugin. #1081

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r3996 r4022  
    246246
    247247      #region validation best model
    248       int targetVariableIndex = ProblemData.Dataset.GetVariableIndex(ProblemData.TargetVariable.Value);
     248      string targetVariable = ProblemData.TargetVariable.Value;
    249249      int validationStart = ValidiationSamplesStart.Value;
    250250      int validationEnd = ValidationSamplesEnd.Value;
     
    257257      OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator();
    258258      foreach (var scaledTree in scaledTrees) {
    259         mseEvaluator.Reset();
    260         IEnumerable<double> estimatedValidationValues = SymbolicExpressionTreeInterpreter.GetSymbolicExpressionTreeValues(scaledTree, ProblemData.Dataset, Enumerable.Range(validationStart, validationEnd - validationStart));
    261         IEnumerable<double> originalValidationValues = ProblemData.Dataset.GetEnumeratedVariableValues(targetVariableIndex, validationStart, validationEnd);
    262         var estimatedEnumerator = estimatedValidationValues.GetEnumerator();
    263         var originalEnumerator = originalValidationValues.GetEnumerator();
    264         while (estimatedEnumerator.MoveNext() & originalEnumerator.MoveNext()) {
    265           double estimated = estimatedEnumerator.Current;
    266           if (double.IsNaN(estimated)) estimated = upperEstimationLimit;
    267           else estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated));
    268           mseEvaluator.Add(originalEnumerator.Current, estimated);
    269         }
    270         double validationMse = mseEvaluator.MeanSquaredError;
     259        double validationMse = SymbolicRegressionMeanSquaredErrorEvaluator.Calculate(SymbolicExpressionTreeInterpreter, scaledTree,
     260          lowerEstimationLimit, upperEstimationLimit,
     261          ProblemData.Dataset, targetVariable,
     262          validationStart, validationEnd);
     263
    271264        if (validationMse < bestValidationMse) {
    272265          bestValidationMse = validationMse;
Note: See TracChangeset for help on using the changeset viewer.