Ignore:
Timestamp:
07/09/14 10:37:01 (8 years ago)
Author:
gkronber
Message:

#2206: made several changes / improvements to the data-preprocessing code while reviewing the code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Implementations/StatisticsLogic.cs

    r10812 r11156  
    4949
    5050      for (int i = 0; i < preprocessingData.Columns; ++i) {
    51         if (preprocessingData.IsType<double>(i)) {
     51        if (preprocessingData.VariableHasType<double>(i)) {
    5252          ++count;
    5353        }
     
    8282    public double GetMedian(int columnIndex, bool considerSelection) {
    8383      double median = double.NaN;
    84       if (preprocessingData.IsType<double>(columnIndex)) {
     84      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    8585        median = GetValuesWithoutNaN<double>(columnIndex, considerSelection).Median();
    8686      }
     
    9090    public double GetAverage(int columnIndex, bool considerSelection) {
    9191      double avg = double.NaN;
    92       if (preprocessingData.IsType<double>(columnIndex)) {
     92      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    9393        avg = GetValuesWithoutNaN<double>(columnIndex, considerSelection).Average();
    9494      }
     
    9898    public DateTime GetMedianDateTime(int columnIndex, bool considerSelection) {
    9999      DateTime median = new DateTime();
    100       if (preprocessingData.IsType<DateTime>(columnIndex)) {
     100      if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    101101        median = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex, considerSelection).Median());
    102102      }
     
    106106    public DateTime GetAverageDateTime(int columnIndex, bool considerSelection) {
    107107      DateTime avg = new DateTime();
    108       if (preprocessingData.IsType<DateTime>(columnIndex)) {
     108      if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    109109        avg = GetSecondsAsDateTime(GetDateTimeAsSeconds(columnIndex, considerSelection).Average());
    110110      }
     
    127127    public double GetStandardDeviation(int columnIndex) {
    128128      double stdDev = double.NaN;
    129       if (preprocessingData.IsType<double>(columnIndex)) {
     129      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    130130        stdDev = GetValuesWithoutNaN<double>(columnIndex).StandardDeviation();
    131       } else if (preprocessingData.IsType<DateTime>(columnIndex)) {
     131      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    132132        stdDev = GetDateTimeAsSeconds(columnIndex).StandardDeviation();
    133133      }
     
    137137    public double GetVariance(int columnIndex) {
    138138      double variance = double.NaN;
    139       if (preprocessingData.IsType<double>(columnIndex)) {
     139      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    140140        variance = GetValuesWithoutNaN<double>(columnIndex).Variance();
    141       } else if (preprocessingData.IsType<DateTime>(columnIndex)) {
     141      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    142142        variance = GetDateTimeAsSeconds(columnIndex).Variance();
    143143      }
     
    163163    }
    164164
    165     public bool IsType<T>(int columnIndex) {
    166       return preprocessingData.IsType<T>(columnIndex);
     165    public bool VariableHasType<T>(int columnIndex) {
     166      return preprocessingData.VariableHasType<T>(columnIndex);
    167167    }
    168168
    169169    public string GetColumnTypeAsString(int columnIndex) {
    170       if (preprocessingData.IsType<double>(columnIndex)) {
     170      if (preprocessingData.VariableHasType<double>(columnIndex)) {
    171171        return "double";
    172       } else if (preprocessingData.IsType<string>(columnIndex)) {
     172      } else if (preprocessingData.VariableHasType<string>(columnIndex)) {
    173173        return "string";
    174       } else if (preprocessingData.IsType<DateTime>(columnIndex)) {
     174      } else if (preprocessingData.VariableHasType<DateTime>(columnIndex)) {
    175175        return "DateTime";
    176176      }
Note: See TracChangeset for help on using the changeset viewer.