Changeset 5551
- Timestamp:
- 02/23/11 11:34:22 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs
r5547 r5551 109 109 110 110 public static IEnumerable<double> LimitToRange(this IEnumerable<double> values, double min, double max) { 111 return from x in values 112 select double.IsNaN(x) ? x : (x < min ? min : (x > max ? max : x)); 111 foreach (var x in values) { 112 if (double.IsNaN(x)) yield return x; 113 else if (x < min) yield return min; 114 else if (x > max) yield return max; 115 else yield return x; 116 } 113 117 } 114 118 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5549 r5551 33 33 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 34 34 IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows); 35 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 36 double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 35 double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 37 36 return new double[2] { r2, solution.Length }; 38 37 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5547 r5551 54 54 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 55 55 IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows); 56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 56 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 58 57 } 59 58 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/MultiObjective/SymbolicRegressionMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5549 r5551 54 54 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 55 55 IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows); 56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 56 double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 58 57 return new double[2] { r2, solution.Length }; 59 58 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectivePearsonRSquaredEvaluator.cs
r5548 r5551 54 54 IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, problemData.Dataset, rows); 55 55 IEnumerable<double> originalValues = problemData.Dataset.GetEnumeratedVariableValues(problemData.TargetVariable, rows); 56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 56 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, estimatedValues); 58 57 } 59 58 }
Note: See TracChangeset
for help on using the changeset viewer.