Changeset 14579 for branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content
- Timestamp:
- 01/18/17 11:17:19 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing Enhancements/HeuristicLab.DataPreprocessing/3.4/Content/HistogramContent.cs
r14459 r14579 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Drawing; … … 33 34 get { return HeuristicLab.Common.Resources.VSImageLibrary.Statistics; } 34 35 } 35 private const int MAX_DISTINCT_VALUES_FOR_CLASSIFCATION = 20;36 36 37 public int ClassifierVariableIndex { get; set; } 37 private const int MAX_DISTINCT_VALUES_FOR_GROUPING = 20; 38 39 public string GroupingVariableName { get; set; } 38 40 39 41 public int Bins { get; set; } … … 53 55 } 54 56 55 public IEnumerable<string> GetVariableNamesFor HistogramClassification() {56 List<string> doubleVariableNames = new List<string>();57 public IEnumerable<string> GetVariableNamesForGrouping() { 58 var variableNames = new List<string>(); 57 59 58 //only return variable names from type double59 60 for (int i = 0; i < PreprocessingData.Columns; ++i) { 60 if (PreprocessingData.VariableHasType<double>(i)) { 61 double distinctValueCount = PreprocessingData.GetValues<double>(i).GroupBy(x => x).Count(); 62 bool distinctValuesOk = distinctValueCount <= MAX_DISTINCT_VALUES_FOR_CLASSIFCATION; 63 if (distinctValuesOk) 64 doubleVariableNames.Add(PreprocessingData.GetVariableName(i)); 65 } 61 int distinctValues = int.MaxValue; 62 if (PreprocessingData.VariableHasType<double>(i)) 63 distinctValues = PreprocessingData.GetValues<double>(i).GroupBy(x => x).Count(); 64 else if (PreprocessingData.VariableHasType<string>(i)) 65 distinctValues = PreprocessingData.GetValues<string>(i).GroupBy(x => x).Count(); 66 else if (PreprocessingData.VariableHasType<DateTime>(i)) 67 distinctValues = PreprocessingData.GetValues<DateTime>(i).GroupBy(x => x).Count(); 68 69 if (distinctValues <= MAX_DISTINCT_VALUES_FOR_GROUPING) 70 variableNames.Add(PreprocessingData.GetVariableName(i)); 66 71 } 67 return doubleVariableNames;72 return variableNames; 68 73 } 69 74 }
Note: See TracChangeset
for help on using the changeset viewer.