Changeset 5547
- Timestamp:
- 02/22/11 17:57:31 (14 years ago)
- Location:
- branches/DataAnalysis Refactoring
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis Refactoring/HeuristicLab.Common/3.3/EnumerableStatisticExtensions.cs
r5445 r5547 107 107 return sortedValues[index] * (1 - percentage) + sortedValues[index + 1] * percentage; 108 108 } 109 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)); 113 } 109 114 } 110 115 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r5514 r5547 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 = BoundEstimatedValues(estimatedValues,lowerEstimationLimit, upperEstimationLimit);56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 57 double mse = OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues); 58 58 return new double[2] { mse, solution.Size }; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r5514 r5547 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 = BoundEstimatedValues(estimatedValues,lowerEstimationLimit, upperEstimationLimit);35 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 36 36 double r2 = OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 37 37 return new double[2] { r2, solution.Size }; -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r5514 r5547 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 = BoundEstimatedValues(estimatedValues,lowerEstimationLimit, upperEstimationLimit);56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 57 return OnlineMeanSquaredErrorEvaluator.Calculate(originalValues, boundedEstimationValues); 58 58 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r5514 r5547 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 = BoundEstimatedValues(estimatedValues,lowerEstimationLimit, upperEstimationLimit);56 IEnumerable<double> boundedEstimationValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 57 57 return OnlinePearsonsRSquaredEvaluator.Calculate(originalValues, boundedEstimationValues); 58 58 } -
branches/DataAnalysis Refactoring/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Evaluators/SymbolicDataAnalysisEvaluator.cs
r5514 r5547 127 127 .Where(i => i < ProblemDataParameter.ActualValue.TestSamplesStart || ProblemDataParameter.ActualValue.TestSamplesEnd <= i); 128 128 } 129 130 public static IEnumerable<double> BoundEstimatedValues(IEnumerable<double> estimatedValues, double lowerEstimationLimit, double upperEstimationLimit) {131 return estimatedValues.Select(v => {132 if (double.IsNaN(v)) return v;133 else if (v < lowerEstimationLimit) return lowerEstimationLimit;134 else if (v > upperEstimationLimit) return upperEstimationLimit;135 return v;136 });137 }138 129 } 139 130 }
Note: See TracChangeset
for help on using the changeset viewer.