- Timestamp:
- 12/11/13 13:24:04 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticInfo.cs
r10191 r10216 1 1 using System; 2 2 using System.Linq; 3 using HeuristicLab.Common; 3 4 4 5 namespace HeuristicLab.DataPreprocessing { … … 57 58 double median = double.NaN; 58 59 if (preprocessingData.IsType<double>(variableName)) { 59 median = preprocessingData.GetValues<double>(variableName). OrderBy(x => x).ElementAt(preprocessingData.Rows / 2);60 median = preprocessingData.GetValues<double>(variableName).Median(); 60 61 } 61 62 return median; … … 82 83 double stdDev = double.NaN; 83 84 if (preprocessingData.IsType<double>(variableName)) { 84 double avg = GetAverage(variableName); 85 stdDev = Math.Sqrt(preprocessingData.GetValues<double>(variableName).Sum(x => (x - avg) * (x - avg)) / (preprocessingData.Rows - 1)); 85 stdDev = preprocessingData.GetValues<double>(variableName).StandardDeviation(); 86 } 87 return stdDev; 88 } 89 90 public double GetVariance(string variableName) { 91 double stdDev = double.NaN; 92 if (preprocessingData.IsType<double>(variableName)) { 93 stdDev = preprocessingData.GetValues<double>(variableName).Variance(); 86 94 } 87 95 return stdDev; -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IStatisticInfo.cs
r10191 r10216 17 17 T GetMostCommonValue<T>(string variableName); 18 18 double GetStandardDeviation(string variableName); 19 double GetVariance(string variableName); 19 20 int GetDifferentValuesCount<T>(string variableName); 20 21 }
Note: See TracChangeset
for help on using the changeset viewer.