Changeset 4202 for branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
- Timestamp:
- 08/11/10 18:39:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
r4195 r4202 32 32 using HeuristicLab.Problems.DataAnalysis.Evaluators; 33 33 using HeuristicLab.Problems.DataAnalysis.Symbolic; 34 using System; 34 35 35 36 namespace HeuristicLab.Problems.DataAnalysis.Regression.Symbolic.Analyzers { … … 285 286 int trainingEnd = ProblemData.TrainingSamplesEnd.Value; 286 287 IEnumerable<int> trainingRows = Enumerable.Range(trainingStart, trainingEnd - trainingStart); 287 SymbolicRegressionScaledMeanSquaredErrorEvaluator.Calculate(SymbolicExpressionTreeInterpreter, bestTree, 288 lowerEstimationLimit, upperEstimationLimit, 289 ProblemData.Dataset, targetVariable, 290 trainingRows, out beta, out alpha); 288 IEnumerable<double> originalValues = ProblemData.Dataset.GetEnumeratedVariableValues(targetVariable, trainingRows); 289 IEnumerable<double> estimatedValues = 290 GetBoundedValues(SymbolicExpressionTreeInterpreter.GetSymbolicExpressionTreeValues(bestTree, ProblemData.Dataset, trainingRows), 291 lowerEstimationLimit, upperEstimationLimit); 292 293 294 SymbolicRegressionScaledMeanSquaredErrorEvaluator.CalculateScalingParameters(originalValues, estimatedValues, out beta, out alpha); 291 295 292 296 // scale tree for solution … … 317 321 AddValue(validationValues, bestQuality, CurrentBestValidationQualityParameterName, CurrentBestValidationQualityParameterName); 318 322 return base.Apply(); 323 } 324 325 private IEnumerable<double> GetBoundedValues(IEnumerable<double> values, double lowerEstimationLimit, double upperEstimationLimit) { 326 foreach (double v in values) { 327 if (double.IsNaN(v)) yield return upperEstimationLimit; 328 else yield return Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, v)); 329 } 319 330 } 320 331
Note: See TracChangeset
for help on using the changeset viewer.