- Timestamp:
- 07/09/10 17:01:36 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
r3996 r4022 246 246 247 247 #region validation best model 248 int targetVariableIndex = ProblemData.Dataset.GetVariableIndex(ProblemData.TargetVariable.Value);248 string targetVariable = ProblemData.TargetVariable.Value; 249 249 int validationStart = ValidiationSamplesStart.Value; 250 250 int validationEnd = ValidationSamplesEnd.Value; … … 257 257 OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator(); 258 258 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 271 264 if (validationMse < bestValidationMse) { 272 265 bestValidationMse = validationMse;
Note: See TracChangeset
for help on using the changeset viewer.