Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10537


Ignore:
Timestamp:
03/05/14 14:11:06 (11 years ago)
Author:
rstoll
Message:
  • Delete samples without sufficient information or variance implemented in TransformationLogic
Location:
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
Files:
4 edited

Legend:

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

    r10534 r10537  
    9797
    9898      return preprocessingData.GetValues<T>(columnIndex)
    99 
    10099                              .GroupBy(x => x)
    101100                              .OrderByDescending(g => g.Count())
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/TransformationLogic.cs

    r10249 r10537  
    11
     2using System;
    23namespace HeuristicLab.DataPreprocessing {
     4
    35  public class TransformationLogic : ITransformationLogic {
     6
     7    private readonly IPreprocessingData preprocessingData;
     8    private readonly ISearchLogic searchLogic;
     9    private readonly IStatisticsLogic statisticsLogic;
     10
     11    public TransformationLogic(IPreprocessingData thePreprocessingData, ISearchLogic theSearchLogic, IStatisticsLogic theStatisticsLogic) {
     12      preprocessingData = thePreprocessingData;
     13      searchLogic = theSearchLogic;
     14      statisticsLogic = theStatisticsLogic;
     15    }
     16
     17    public void deleteRowsWithMissingValuesGreater(double percent) {
     18      for (int i = 0; i < preprocessingData.Rows; ++i) {
     19        int missingCount = statisticsLogic.GetRowMissingValueCount(i);
     20        if (100f / preprocessingData.Columns * missingCount >= percent) {
     21          preprocessingData.DeleteRow(i);
     22          --i;
     23        }
     24      }
     25    }
     26
     27    public void deleteColumnsWithMissingValuesGreater(float percent) {
     28      for (int i = 0; i < preprocessingData.Columns; ++i) {
     29        int missingCount = statisticsLogic.GetMissingValueCount(i);
     30        if (100f / preprocessingData.Columns * missingCount >= percent) {
     31          preprocessingData.DeleteColumn(i);
     32          --i;
     33        }
     34      }
     35    }
     36
     37    public void deleteColumnsWithVarianceSmaller(double variance) {
     38      for (int i = 0; i < preprocessingData.Columns; ++i) {
     39        if (preprocessingData.IsType<double>(i) || preprocessingData.IsType<DateTime>(i)) {
     40          double columnVariance = statisticsLogic.GetVariance(i);
     41          if (columnVariance < variance) {
     42            preprocessingData.DeleteColumn(i);
     43            --i;
     44          }
     45        }
     46      }
     47    }
     48
    449  }
    550}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/ITransformationLogic.cs

    r10244 r10537  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 
    6 namespace HeuristicLab.DataPreprocessing
    7 {
    8   public interface ITransformationLogic
    9   {
     1
     2namespace HeuristicLab.DataPreprocessing {
     3  public interface ITransformationLogic {
     4    void deleteRowsWithMissingValuesGreater(double percent);
     5    void deleteColumnsWithMissingValuesGreater(float percent);
     6    void deleteColumnsWithVarianceSmaller(double variance);
    107  }
    118}
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataPreprocessingView.cs

    r10383 r10537  
    4646      ISearchLogic searchLogic = new SearchLogic(data);
    4747      var dataGridLogic = new DataGridLogic(data);
    48       dataGridContent = new DataGridContent(dataGridLogic, new ManipulationLogic(data, searchLogic, new StatisticsLogic(data, searchLogic)));
    49       statisticsContent = new StatisticsContent(new StatisticsLogic(data, searchLogic));
     48      StatisticsLogic statisticsLogic = new StatisticsLogic(data, searchLogic);
     49      dataGridContent = new DataGridContent(dataGridLogic, new ManipulationLogic(data, searchLogic, statisticsLogic));
     50      statisticsContent = new StatisticsContent(statisticsLogic);
    5051      filterContent = new FilterContent(new FilterLogic());
    51       tranformationContent = new TransformationContent(new TransformationLogic());
     52      tranformationContent = new TransformationContent(new TransformationLogic(data, searchLogic, statisticsLogic));
    5253      lineChartContent = new LineChartContent(new LineChartLogic(data));
    5354      histogramContent = new HistogramContent(new HistogramLogic());
Note: See TracChangeset for help on using the changeset viewer.