Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/28/14 15:09:26 (10 years ago)
Author:
mleitner
Message:

Add Feature correlation matrix, Add limit for distinct values in histogramm classification.

File:
1 edited

Legend:

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

    r10882 r10908  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3232
    3333  public class ChartLogic : IChartLogic {
    34  
     34    private const int MAX_DISTINCT_VALUES_FOR_CLASSIFCATION = 20;
    3535    private ITransactionalPreprocessingData preprocessingData;
    3636
     
    6363    }
    6464
    65     public List<double> GetVariableValues(string variableName) {
    66       return preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName)).ToList();
     65    public IEnumerable<double> GetVariableValues(string variableName) {
     66      return preprocessingData.GetValues<double>(preprocessingData.GetColumnIndex(variableName));
    6767    }
    6868
     
    7474        if (preprocessingData.IsType<double>(preprocessingData.GetColumnIndex(variableName)))
    7575          doubleVariableNames.Add(variableName);
     76      }
     77
     78      return doubleVariableNames;
     79    }
     80
     81    public IEnumerable<string> GetVariableNamesForHistogramClassification() {
     82      List<string> doubleVariableNames = new List<string>();
     83
     84      //only return variable names from type double
     85      foreach (string variableName in preprocessingData.VariableNames)
     86      {
     87        int columnIndex           = preprocessingData.GetColumnIndex(variableName);
     88        bool isDouble             = preprocessingData.IsType<double>(columnIndex);
     89        double distinctValueCount = preprocessingData.GetValues<double>(columnIndex).GroupBy(x => x).Count();
     90        bool distinctValuesOk     = distinctValueCount <= MAX_DISTINCT_VALUES_FOR_CLASSIFCATION;
     91
     92        if (isDouble && distinctValuesOk)
     93              doubleVariableNames.Add(variableName);
    7694      }
    7795
     
    146164     
    147165
    148       List<double> xValues = GetVariableValues(variableNameX);
    149       List<double> yValues = GetVariableValues(variableNameY);
     166      List<double> xValues = GetVariableValues(variableNameX).ToList();
     167      List<double> yValues = GetVariableValues(variableNameY).ToList();
    150168
    151169      List<Point2D<double>> points = new List<Point2D<double>>();
Note: See TracChangeset for help on using the changeset viewer.