Changeset 4112 for trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators
- Timestamp:
- 07/27/10 14:36:27 (14 years ago)
- 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 65 65 66 66 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); 89 68 } 90 69 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionNormalizedMseEvaluator.cs
r4068 r4112 73 73 tree.Root.SubTrees[0].AddSubTree(treeNode); 74 74 } 75 return nmseSum / targetVariablesList.Count;75 return nmseSum; 76 76 } 77 77 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledMseEvaluator.cs
r4068 r4112 75 75 double mse = SymbolicRegressionScaledMeanSquaredErrorEvaluator.Calculate(interpreter, tree, 76 76 lowerEstimationBound[i], upperEstimationBound[i], 77 problemData.Dataset, targetVariablesList[i], rows, out comp Alpha, out compBeta);77 problemData.Dataset, targetVariablesList[i], rows, out compBeta, out compAlpha); 78 78 79 79 qualities[i] = mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledNormalizedMseEvaluator.cs
r4087 r4112 87 87 AlphaParameter.ActualValue = alpha; 88 88 BetaParameter.ActualValue = beta; 89 QualityParameter.ActualValue = new DoubleValue(nmseSum / targetVariables.Count());89 QualityParameter.ActualValue = new DoubleValue(nmseSum); 90 90 } 91 91 }
Note: See TracChangeset
for help on using the changeset viewer.