Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10166


Ignore:
Timestamp:
11/27/13 16:37:31 (11 years ago)
Author:
sbreuer
Message:
  • implement GetAverage and GetMedian
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/PreprocessingDataStatisticInfo.cs

    r10165 r10166  
    22using System.Linq;
    33using HeuristicLab.DataPreprocessing.Interfaces;
     4using System.Linq;
    45
    56namespace HeuristicLab.DataPreprocessing {
     
    6465
    6566    public double GetMedian(int columnIndex) {
    66       throw new System.NotImplementedException();
     67      double median = double.NaN;
     68      if (preprocessingData.IsType<double>(columnIndex)) {
     69        median = preprocessingData.GetValues<double>(columnIndex).OrderBy(x => x).ElementAt(preprocessingData.Rows / 2);
     70      }
     71      return median;
    6772    }
    6873
    6974    public double GetAverage(int columnIndex) {
    70       throw new System.NotImplementedException();
     75      double avg = double.NaN;
     76      if (preprocessingData.IsType<double>(columnIndex)) {
     77        avg = preprocessingData.GetValues<double>(columnIndex).Average();
     78      }
     79      return avg;
    7180    }
    7281
Note: See TracChangeset for help on using the changeset viewer.