Changeset 8689 for trunk/sources/HeuristicLab.Problems.DataAnalysis
- Timestamp:
- 09/24/12 18:48:16 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/FeatureCorrelation/FeatureCorrelationCalculator.cs
r8578 r8689 111 111 112 112 IList<string> doubleVariableNames = dataset.DoubleVariables.ToList(); 113 OnlineCalculatorError error ;113 OnlineCalculatorError error = OnlineCalculatorError.None; 114 114 int length = doubleVariableNames.Count; 115 115 double[,] elements = new double[length, length]; … … 124 124 return; 125 125 } 126 127 126 IEnumerable<double> var1 = GetRelevantValues(problemData, partition, doubleVariableNames[i]); 128 127 IEnumerable<double> var2 = GetRelevantValues(problemData, partition, doubleVariableNames[j]); … … 130 129 elements[i, j] = CalculateElementWithCalculator(calc, var1, var2, out error); 131 130 131 if (!error.Equals(OnlineCalculatorError.None)) { 132 elements[i, j] = double.NaN; 133 } 132 134 elements[j, i] = elements[i, j]; 133 if (!error.Equals(OnlineCalculatorError.None)) {134 worker.ReportProgress(100);135 throw new ArgumentException("Calculator returned " + error + Environment.NewLine + "Maybe try another calculator.");136 }137 135 worker.ReportProgress((int)Math.Round((((Math.Pow(i, 2) + i) / 2 + j + 1.0) / calculations) * 100)); 138 136 } … … 153 151 154 152 IList<string> doubleVariableNames = dataset.DoubleVariables.ToList(); 155 OnlineCalculatorError error ;153 OnlineCalculatorError error = OnlineCalculatorError.None; 156 154 int length = doubleVariableNames.Count; 157 155 double[,] elements = new double[length, frames + 1]; … … 186 184 187 185 if (!error.Equals(OnlineCalculatorError.None)) { 188 worker.ReportProgress(100); 189 throw new ArgumentException("Calculator returned " + error + Environment.NewLine + "Maybe try another calculator."); 186 elements[i, j] = double.NaN; 190 187 } 191 188 worker.ReportProgress((int)((100.0 / calculations) * (i * (frames + 1) + j + 1))); -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/SpearmansRankCorrelationCoefficientCalculator.cs
r8542 r8689 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; … … 27 28 28 29 public static double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) { 29 double rs = alglib.basestat.spearmancorr2(originalValues.ToArray(), estimatedValues.ToArray(), originalValues.Count()); 30 errorState = OnlineCalculatorError.None; 30 double rs = double.NaN; 31 try { 32 rs = alglib.basestat.spearmancorr2(originalValues.ToArray(), estimatedValues.ToArray(), originalValues.Count()); 33 errorState = OnlineCalculatorError.None; 34 } 35 catch (Exception ex) { 36 errorState = OnlineCalculatorError.InvalidValueAdded; 37 } 38 31 39 return rs; 32 40 }
Note: See TracChangeset
for help on using the changeset viewer.