Changeset 10383 for branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs
- Timestamp:
- 01/22/14 16:53:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticsLogic.cs
r10381 r10383 1 1 using System; 2 using System.Collections.Generic; 2 3 using System.Linq; 3 4 using HeuristicLab.Common; 4 using System.Collections.Generic;5 5 6 6 namespace HeuristicLab.DataPreprocessing { … … 75 75 } 76 76 77 public DateTime GetMedianDateTime(int columnIndex) 78 { 77 public DateTime GetMedianDateTime(int columnIndex) { 79 78 DateTime median = new DateTime(); 80 if (preprocessingData.IsType<DateTime>(columnIndex)) 81 { 82 median = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Median()); 79 if (preprocessingData.IsType<DateTime>(columnIndex)) { 80 median = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Median()); 83 81 } 84 82 return median; 85 83 } 86 84 87 public DateTime GetAverageDateTime(int columnIndex) 88 { 85 public DateTime GetAverageDateTime(int columnIndex) { 89 86 DateTime avg = new DateTime(); 90 if (preprocessingData.IsType<DateTime>(columnIndex)) 91 { 92 avg = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Average()); 87 if (preprocessingData.IsType<DateTime>(columnIndex)) { 88 avg = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex).Average()); 93 89 } 94 90 return avg; … … 107 103 public double GetStandardDeviation(int columnIndex) { 108 104 double stdDev = double.NaN; 105 //TODO: fix me 106 /* 109 107 if (preprocessingData.IsType<double>(columnIndex)) { 110 108 stdDev = preprocessingData.GetValues<double>(columnIndex).StandardDeviation(); … … 113 111 stdDev = GetDateTimeAsSeconds(variableName).StandardDeviation(); 114 112 } 113 */ 115 114 return stdDev; 116 115 } 117 116 118 117 public double GetVariance(int columnIndex) { 119 double variance = double.NaN; 120 118 double variance = double.NaN; 119 //TODO: fix me 120 /* 121 121 if (preprocessingData.IsType<double>(columnIndex)) { 122 122 variance = preprocessingData.GetValues<double>(columnIndex).Variance(); … … 125 125 variance = GetDateTimeAsSeconds(variableName).Variance(); 126 126 } 127 */ 127 128 return variance; 128 129 } … … 161 162 } 162 163 163 private IEnumerable<double> GetDateTimeAsSeconds(int columnIndex) 164 { 165 return preprocessingData.GetValues<DateTime>(columnIndex).Select(x => (double)x.Ticks / TimeSpan.TicksPerSecond); 164 private IEnumerable<double> GetDateTimeAsSeconds(int columnIndex) { 165 return preprocessingData.GetValues<DateTime>(columnIndex).Select(x => (double)x.Ticks / TimeSpan.TicksPerSecond); 166 166 } 167 167 168 private DateTime GetSecondsAsDateTime(double seconds) 169 { 170 DateTime dateTime = new DateTime(); 171 return dateTime.Add(new TimeSpan(0, 0, (int)seconds)); 168 private DateTime GetSecondsAsDateTime(double seconds) { 169 DateTime dateTime = new DateTime(); 170 return dateTime.Add(new TimeSpan(0, 0, (int)seconds)); 172 171 } 173 172 }
Note: See TracChangeset
for help on using the changeset viewer.