Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/02/14 14:50:03 (11 years ago)
Author:
rstoll
Message:

Moved methods for "delete columns/rows without sufficient information" from ITransformationLogic to IManipulationLogic

Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations
Files:
2 edited

Legend:

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

    r10709 r10711  
    255255      });
    256256    }
     257
     258
     259    public void DeleteRowsWithMissingValuesGreater(double percent) {
     260      for (int i = 0; i < preprocessingData.Rows; ++i) {
     261        int missingCount = statisticsLogic.GetRowMissingValueCount(i);
     262        if (100f / preprocessingData.Columns * missingCount >= percent) {
     263          preprocessingData.DeleteRow(i);
     264          --i;
     265        }
     266      }
     267    }
     268
     269    public void DeleteColumnsWithMissingValuesGreater(float percent) {
     270      for (int i = 0; i < preprocessingData.Columns; ++i) {
     271        int missingCount = statisticsLogic.GetMissingValueCount(i);
     272        if (100f / preprocessingData.Columns * missingCount >= percent) {
     273          preprocessingData.DeleteColumn(i);
     274          --i;
     275        }
     276      }
     277    }
     278
     279    public void DeleteColumnsWithVarianceSmaller(double variance) {
     280      for (int i = 0; i < preprocessingData.Columns; ++i) {
     281        if (preprocessingData.IsType<double>(i) || preprocessingData.IsType<DateTime>(i)) {
     282          double columnVariance = statisticsLogic.GetVariance(i);
     283          if (columnVariance < variance) {
     284            preprocessingData.DeleteColumn(i);
     285            --i;
     286          }
     287        }
     288      }
     289    }
     290
    257291  }
    258292}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationLogic.cs

    r10586 r10711  
    2020#endregion
    2121
    22 using System;
    2322
    2423namespace HeuristicLab.DataPreprocessing {
     
    3635    }
    3736
    38     public void DeleteRowsWithMissingValuesGreater(double percent) {
    39       for (int i = 0; i < preprocessingData.Rows; ++i) {
    40         int missingCount = statisticsLogic.GetRowMissingValueCount(i);
    41         if (100f / preprocessingData.Columns * missingCount >= percent) {
    42           preprocessingData.DeleteRow(i);
    43           --i;
    44         }
    45       }
    46     }
    47 
    48     public void DeleteColumnsWithMissingValuesGreater(float percent) {
    49       for (int i = 0; i < preprocessingData.Columns; ++i) {
    50         int missingCount = statisticsLogic.GetMissingValueCount(i);
    51         if (100f / preprocessingData.Columns * missingCount >= percent) {
    52           preprocessingData.DeleteColumn(i);
    53           --i;
    54         }
    55       }
    56     }
    57 
    58     public void DeleteColumnsWithVarianceSmaller(double variance) {
    59       for (int i = 0; i < preprocessingData.Columns; ++i) {
    60         if (preprocessingData.IsType<double>(i) || preprocessingData.IsType<DateTime>(i)) {
    61           double columnVariance = statisticsLogic.GetVariance(i);
    62           if (columnVariance < variance) {
    63             preprocessingData.DeleteColumn(i);
    64             --i;
    65           }
    66         }
    67       }
    68     }
    69 
    7037  }
    7138}
Note: See TracChangeset for help on using the changeset viewer.