Changeset 7678
- Timestamp:
- 03/30/12 23:10:26 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r7272 r7678 141 141 <Compile Include="Interfaces\Regression\IRegressionEnsembleSolution.cs" /> 142 142 <Compile Include="Implementation\Regression\RegressionSolutionBase.cs" /> 143 <Compile Include="OnlineCalculators\OnlineMaxAbsoluteErrorCalculator.cs" /> 143 144 <Compile Include="OnlineCalculators\OnlineMeanErrorCalculator.cs" /> 144 145 <Compile Include="OnlineCalculators\NormalizedGiniCalculator.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineMaxAbsoluteErrorCalculator.cs
r7670 r7678 24 24 25 25 namespace HeuristicLab.Problems.DataAnalysis { 26 public class OnlineM eanAbsoluteErrorCalculator : IOnlineCalculator {26 public class OnlineMaxAbsoluteErrorCalculator : IOnlineCalculator { 27 27 28 private double sae;28 private double mae; 29 29 private int n; 30 public double M eanAbsoluteError {30 public double MaxAbsoluteError { 31 31 get { 32 return n > 0 ? sae / n: 0.0;32 return n > 0 ? mae : 0.0; 33 33 } 34 34 } 35 35 36 public OnlineM eanAbsoluteErrorCalculator() {36 public OnlineMaxAbsoluteErrorCalculator() { 37 37 Reset(); 38 38 } … … 44 44 } 45 45 public double Value { 46 get { return M eanAbsoluteError; }46 get { return MaxAbsoluteError; } 47 47 } 48 48 public void Reset() { 49 49 n = 0; 50 sae = 0.0;50 mae = double.MinValue; 51 51 errorState = OnlineCalculatorError.InsufficientElementsAdded; 52 52 } … … 57 57 errorState = errorState | OnlineCalculatorError.InvalidValueAdded; 58 58 } else { 59 double error = estimated - original; 60 sae += Math.Abs(error); 59 double error = Math.Abs(estimated - original); 60 if (error > mae) 61 mae = error; 61 62 n++; 62 63 errorState = errorState & (~OnlineCalculatorError.InsufficientElementsAdded); // n >= 1 … … 68 69 IEnumerator<double> originalEnumerator = originalValues.GetEnumerator(); 69 70 IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator(); 70 OnlineM eanAbsoluteErrorCalculator maeCalculator = new OnlineMeanAbsoluteErrorCalculator();71 OnlineMaxAbsoluteErrorCalculator maeCalculator = new OnlineMaxAbsoluteErrorCalculator(); 71 72 72 73 // always move forward both enumerators (do not use short-circuit evaluation!) … … 84 85 } else { 85 86 errorState = maeCalculator.ErrorState; 86 return maeCalculator.M eanAbsoluteError;87 return maeCalculator.MaxAbsoluteError; 87 88 } 88 89 }
Note: See TracChangeset
for help on using the changeset viewer.