Changeset 8905:a47ce13f76c3 in orange


Ignore:
Timestamp:
09/05/11 12:16:55 (3 years ago)
Author:
jzbontar <jure.zbontar@…>
Branch:
default
Convert:
46929e3cda3530cb73efca502f12faf43fc29775
Message:

SimpleTree minExamples -> minInstances

Location:
source/orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/tdidt_simple.cpp

    r8818 r8905  
    4747 
    4848struct Args { 
    49     int minExamples, maxDepth; 
     49    int minInstances, maxDepth; 
    5050    float maxMajority, skipProb; 
    5151 
     
    102102 
    103103    for (i = 0; i < attr_vals; i++) 
    104         if (attr_dist[i] > 0.0 && attr_dist[i] < args->minExamples) 
     104        if (attr_dist[i] > 0.0 && attr_dist[i] < args->minInstances) 
    105105            return 0; 
    106106    return 1; 
     
    111111{ 
    112112    struct Example *ex, *ex_end, *ex_next; 
    113     int i, cls, cls_vals, minExamples, size_known; 
     113    int i, cls, cls_vals, minInstances, size_known; 
    114114    float score, *dist_lt, *dist_ge, *attr_dist, best_score, size_weight; 
    115115 
    116116    cls_vals = args->domain->classVar->noOfValues(); 
    117117 
    118     /* minExamples should be at least 1, otherwise there is no point in splitting */ 
    119     minExamples = args->minExamples < 1 ? 1 : args->minExamples; 
     118    /* minInstances should be at least 1, otherwise there is no point in splitting */ 
     119    minInstances = args->minInstances < 1 ? 1 : args->minInstances; 
    120120 
    121121    /* allocate space */ 
     
    144144    best_score = -INFINITY; 
    145145 
    146     for (ex = examples, ex_end = ex + size_known - minExamples, ex_next = ex + 1, i = 0; ex < ex_end; ex++, ex_next++, i++) { 
     146    for (ex = examples, ex_end = ex + size_known - minInstances, ex_next = ex + 1, i = 0; ex < ex_end; ex++, ex_next++, i++) { 
    147147        if (!ex->example->getClass().isSpecial()) { 
    148148            cls = ex->example->getClass().intV; 
     
    153153        attr_dist[1] -= ex->weight; 
    154154 
    155         if (ex->example->values[attr] == ex_next->example->values[attr] || i + 1 < minExamples) 
     155        if (ex->example->values[attr] == ex_next->example->values[attr] || i + 1 < minInstances) 
    156156            continue; 
    157157 
     
    247247{ 
    248248    struct Example *ex, *ex_end, *ex_next; 
    249     int i, cls_vals, minExamples, size_known; 
     249    int i, cls_vals, minInstances, size_known; 
    250250    float size_attr_known, size_weight, cls_val, cls_score, best_score, size_attr_cls_known, score; 
    251251 
     
    256256    cls_vals = args->domain->classVar->noOfValues(); 
    257257 
    258     /* minExamples should be at least 1, otherwise there is no point in splitting */ 
    259     minExamples = args->minExamples < 1 ? 1 : args->minExamples; 
     258    /* minInstances should be at least 1, otherwise there is no point in splitting */ 
     259    minInstances = args->minInstances < 1 ? 1 : args->minInstances; 
    260260 
    261261    /* sort */ 
     
    288288    best_score = -INFINITY; 
    289289 
    290     for (ex = examples, ex_end = ex + size_known - minExamples, ex_next = ex + 1, i = 0; ex < ex_end; ex++, ex_next++, i++) { 
     290    for (ex = examples, ex_end = ex + size_known - minInstances, ex_next = ex + 1, i = 0; ex < ex_end; ex++, ex_next++, i++) { 
    291291        if (!ex->example->getClass().isSpecial()) { 
    292292            cls_val = ex->example->getClass(); 
     
    300300        } 
    301301 
    302         if (ex->example->values[attr] == ex_next->example->values[attr] || i + 1 < minExamples) 
     302        if (ex->example->values[attr] == ex_next->example->values[attr] || i + 1 < minInstances) 
    303303            continue; 
    304304 
     
    589589} 
    590590 
    591 TSimpleTreeLearner::TSimpleTreeLearner(const int &weight, float maxMajority, int minExamples, int maxDepth, float skipProb) : 
     591TSimpleTreeLearner::TSimpleTreeLearner(const int &weight, float maxMajority, int minInstances, int maxDepth, float skipProb) : 
    592592    maxMajority(maxMajority), 
    593     minExamples(minExamples), 
     593    minInstances(minInstances), 
    594594    maxDepth(maxDepth), 
    595595    skipProb(skipProb) 
     
    617617 
    618618    ASSERT(args.attr_split_so_far = (int *)calloc(ogen->domain->attributes->size(), sizeof(int))); 
    619     args.minExamples = minExamples; 
     619    args.minInstances = minInstances; 
    620620    args.maxMajority = maxMajority; 
    621621    args.maxDepth = maxDepth; 
  • source/orange/tdidt_simple.hpp

    r8770 r8905  
    3939    __REGISTER_CLASS 
    4040    float maxMajority; //P 
    41     int minExamples; //P 
     41    int minInstances; //P 
    4242    int maxDepth; //P 
    4343    float skipProb; //P 
Note: See TracChangeset for help on using the changeset viewer.