Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10191


Ignore:
Timestamp:
12/04/13 15:22:40 (10 years ago)
Author:
rstoll
Message:
  • GetRowMissingValueCount implemented
  • IsMissingValue for cell implemented
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs

    r10189 r10191  
    157157    }
    158158
     159    public bool IsMissingValue(string variableName, int rowIndex) {
     160      if (IsType<double>(variableName)) {
     161        return double.IsNaN(GetCell<double>(variableName, rowIndex));
     162      } else if (IsType<string>(variableName)) {
     163        return string.IsNullOrEmpty(GetCell<string>(variableName, rowIndex));
     164      } else if (IsType<DateTime>(variableName)) {
     165        return GetCell<DateTime>(variableName, rowIndex).Equals(DateTime.MinValue);
     166      } else {
     167        throw new ArgumentException("cell in column with variableName: " + variableName + " and row index " + rowIndex + " contains a non supported type.");
     168      }
     169    }
     170
    159171    public IEnumerable<int> GetMissingValueIndices(string variableName) {
    160172      if (IsType<double>(variableName)) {
     
    165177        return GetValues<DateTime>(variableName).Select((s, i) => new { i, s }).Where(t => t.s.Equals(DateTime.MinValue)).Select(t => t.i);
    166178      } else {
    167         throw new ArgumentException("column with index: " + variableName + " contains a non supported type.");
     179        throw new ArgumentException("column with variableName: " + variableName + " contains a non supported type.");
    168180      }
    169181    }
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/StatisticInfo.cs

    r10189 r10191  
    9191      return preprocessingData.GetValues<T>(variableName).GroupBy(x => x).Count();
    9292    }
     93
     94    public int GetRowMissingValueCount(int rowIndex) {
     95      int count = 0;
     96      foreach (var variableName in preprocessingData.VariableNames) {
     97        if (preprocessingData.IsMissingValue(variableName, rowIndex)) {
     98          ++count;
     99        }
     100      }
     101      return count;
     102    }
    93103  }
    94104}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs

    r10189 r10191  
    5959    /// <returns></returns>
    6060    IEnumerable<int> GetMissingValueIndices(string variableName);
     61
     62    bool IsMissingValue(string variableName, int rowIndex);
    6163  }
    6264}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IStatisticInfo.cs

    r10183 r10191  
    1010    int GetMissingValueCount();
    1111    int GetMissingValueCount(string variableName);
     12    int GetRowMissingValueCount(int rowIndex);
    1213    T GetMin<T>(string variableName) where T : IComparable<T>;
    1314    T GetMax<T>(string variableName) where T : IComparable<T>;
Note: See TracChangeset for help on using the changeset viewer.