Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/24/16 14:00:28 (8 years ago)
Author:
mkommend
Message:

#2616: Added default value for min, max and most common value operations for data preprocessing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataPreprocessing/3.4/Logic/StatisticsLogic.cs

    r13934 r13935  
    7171    }
    7272
    73     public T GetMin<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> {
    74       var min = default(T);
     73    public T GetMin<T>(int columnIndex, T defaultValue, bool considerSelection = false) where T : IComparable<T> {
     74      var min = defaultValue;
    7575      if (preprocessingData.VariableHasType<T>(columnIndex)) {
    7676        var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection);
     
    8282    }
    8383
    84     public T GetMax<T>(int columnIndex, bool considerSelection = false) where T : IComparable<T> {
    85       var max = default(T);
     84    public T GetMax<T>(int columnIndex, T defaultValue, bool considerSelection = false) where T : IComparable<T> {
     85      var max = defaultValue;
    8686      if (preprocessingData.VariableHasType<T>(columnIndex)) {
    8787        var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection);
     
    131131    }
    132132
    133     public T GetMostCommonValue<T>(int columnIndex, bool considerSelection = false) {
     133    public T GetMostCommonValue<T>(int columnIndex, T defaultValue, bool considerSelection = false) {
    134134      var values = GetValuesWithoutNaN<T>(columnIndex, considerSelection);
    135135      if (!values.Any())
    136         return default(T);
     136        return defaultValue;
    137137      return values.GroupBy(x => x)
    138138                              .OrderByDescending(g => g.Count())
Note: See TracChangeset for help on using the changeset viewer.