Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/13 15:22:40 (11 years ago)
Author:
rstoll
Message:
  • GetRowMissingValueCount implemented
  • IsMissingValue for cell implemented
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
Files:
2 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}
Note: See TracChangeset for help on using the changeset viewer.