Changeset 8064:9be36bdabbbd in orange


Ignore:
Timestamp:
07/04/11 09:59:28 (3 years ago)
Author:
jzbontar <jure.zbontar@…>
Branch:
default
Convert:
5bc44cd1b00859fa5f19ceec2772725f4da25b59
Message:

SimpleTree: randomly select a subset of attributes for every split

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/tdidt_simple.cpp

    r8063 r8064  
    5252compar_examples(TExample **e1, TExample **e2) 
    5353{ 
    54     /* 
    5554    if ((*e1)->values[compar_attr].isSpecial()) 
    5655        return 1; 
    5756    if ((*e2)->values[compar_attr].isSpecial()) 
    5857        return -1; 
    59     */ 
    6058    return (*e1)->values[compar_attr].compare((*e2)->values[compar_attr]); 
    6159} 
     
    238236        for (i = 0, it = domain->attributes->begin(); it != domain->attributes->end(); it++, i++) 
    239237            if (!args->attr_split_so_far[i]) { 
     238 
     239                /* select random subset of attributes - CHANGE ME */ 
     240                if ((double)rand() / RAND_MAX < 0.8)  
     241                    continue; 
     242             
    240243                if ((*it)->varType == TValue::INTVAR) { 
    241244                    score = score_attribute_d(examples, size, i, cls_entropy, args); 
Note: See TracChangeset for help on using the changeset viewer.