Changeset 4611:c26ec5247d72 in orange


Ignore:
Timestamp:
04/22/08 21:26:11 (6 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
171cf576800432800bc486950fe053f0ec6c2024
Message:
  • fixed the bug with minSubset requiring at least two branches with the corresponding number of examples instead of all
File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/tdidt_split.cpp

    r4155 r4611  
    135135 
    136136 
    137 // if there are less than two branches with at least minSubset examples, skip the attribute 
    138 // also, skip it if all examples are in the same branch 
     137// rejects the split if there are less than two non-empty branches 
     138// or there is a non-empty branch with less then minSubset examples 
    139139bool checkDistribution(const TDiscDistribution &dist, const float &minSubset) 
    140140{ 
    141141  int nonzero = 0; 
    142   for(TDiscDistribution::const_iterator dvi(dist.begin()), dve(dist.end()); (dvi!=dve) && (nonzero<2); dvi++) 
    143     if ((*dvi > 0) && (*dvi >= minSubset)) 
     142  for(TDiscDistribution::const_iterator dvi(dist.begin()), dve(dist.end()); dvi!=dve; dvi++) 
     143    if (*dvi > 0) { 
     144      if  (*dvi < minSubset) 
     145        return false; 
    144146      nonzero++; 
     147    } 
    145148 
    146149  return nonzero >= 2; 
Note: See TracChangeset for help on using the changeset viewer.