Changeset 476
- Timestamp:
- 08/09/08 12:18:20 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.StructureIdentification/Evaluation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/AccuracyEvaluator.cs
r474 r476 64 64 double origClass = dataset.GetValue(sample, targetVariable); 65 65 double estClass = double.NaN; 66 if(est < classesArr[0]) estClass = classesArr[0]; 67 else if(est > classesArr[classesArr.Length - 1]) estClass = classesArr[classesArr.Length - 1]; 66 // if estimation is lower than the smallest threshold value -> estimated class is the lower class 67 if(est < thresholds[0]) estClass = classesArr[0]; 68 // if estimation is larger (or equal) than the largest threshold value -> estimated class is the upper class 69 else if(est >= thresholds[thresholds.Length - 1]) estClass = classesArr[classesArr.Length - 1]; 68 70 else { 71 // otherwise the estimated class is the class which upper threshold is larger than the estimated value 69 72 for(int k = 0; k < thresholds.Length; k++) { 70 73 if(thresholds[k] > est) { 71 estClass = classesArr[k + 1];74 estClass = classesArr[k]; 72 75 break; 73 76 } -
trunk/sources/HeuristicLab.StructureIdentification/Evaluation/ClassificationMeanSquaredErrorEvaluator.cs
r475 r476 66 66 } 67 67 double error = estimated - original; 68 if(estimated < classesArr[0] || 69 estimated > classesArr[classesArr.Length - 1]) { 68 // between classes use squared error 69 // on the lower end and upper end only add linear error if the absolute error is larger than 1 70 // the error>1.0 constraint is needed for balance because in the interval ]-1, 1[ the squared error is smaller than the absolute error 71 if(error < -1.0 && original == classesArr[0] && estimated < classesArr[0] || 72 error > 1.0 && original == classesArr[classesArr.Length - 1] && estimated > classesArr[classesArr.Length - 1]) { 70 73 errorsSquaredSum += Math.Abs(error); // only add linear error below the smallest class or above the largest class 71 74 } else { … … 74 77 } 75 78 76 errorsSquaredSum /= (trainingEnd -trainingStart);79 errorsSquaredSum /= (trainingEnd - trainingStart); 77 80 if(double.IsNaN(errorsSquaredSum) || double.IsInfinity(errorsSquaredSum)) { 78 81 errorsSquaredSum = double.MaxValue; 79 82 } 80 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * (trainingEnd -trainingStart);83 scope.GetVariableValue<DoubleData>("TotalEvaluatedNodes", true).Data = totalEvaluatedNodes + treeSize * (trainingEnd - trainingStart); 81 84 return errorsSquaredSum; 82 85 }
Note: See TracChangeset
for help on using the changeset viewer.