Changeset 5894 for trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineLinearScalingParameterCalculator.cs
- Timestamp:
- 03/30/11 18:04:03 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineEvaluators/OnlineLinearScalingParameterCalculator.cs
r5818 r5894 32 32 public double Alpha { 33 33 get { 34 if (cnt < 2) 35 return 0; 36 else 37 return targetMeanCalculator.Mean - Beta * originalMeanAndVarianceCalculator.Mean; 34 return targetMeanCalculator.Mean - Beta * originalMeanAndVarianceCalculator.Mean; 38 35 } 39 36 } … … 44 41 public double Beta { 45 42 get { 46 if (cnt < 2) 47 return 1; 48 else if (originalMeanAndVarianceCalculator.PopulationVariance.IsAlmost(0.0)) 43 if (originalMeanAndVarianceCalculator.PopulationVariance.IsAlmost(0.0)) 49 44 return 1; 50 45 else 51 46 return originalTargetCovarianceEvaluator.Covariance / originalMeanAndVarianceCalculator.PopulationVariance; 47 } 48 } 49 50 public OnlineEvaluatorError ErrorState { 51 get { 52 return targetMeanCalculator.MeanErrorState | originalMeanAndVarianceCalculator.MeanErrorState | 53 originalMeanAndVarianceCalculator.PopulationVarianceErrorState | originalTargetCovarianceEvaluator.ErrorState; 52 54 } 53 55 } … … 94 96 /// <param name="alpha">Additive constant for the linear scaling</param> 95 97 /// <param name="beta">Multiplicative factor for the linear scaling</param> 96 public static void Calculate(IEnumerable<double> original, IEnumerable<double> target, out double alpha, out double beta) { 98 /// <param name="errorState">Flag that indicates if errors occurred in the calculation of the linea scaling parameters.</param> 99 public static void Calculate(IEnumerable<double> original, IEnumerable<double> target, out double alpha, out double beta, out OnlineEvaluatorError errorState) { 97 100 OnlineLinearScalingParameterCalculator calculator = new OnlineLinearScalingParameterCalculator(); 98 101 IEnumerator<double> originalEnumerator = original.GetEnumerator(); … … 110 113 throw new ArgumentException("Number of elements in original and target enumeration do not match."); 111 114 } else { 115 errorState = calculator.ErrorState; 112 116 alpha = calculator.Alpha; 113 117 beta = calculator.Beta;
Note: See TracChangeset
for help on using the changeset viewer.