Changeset 7993:749d957f99cd in orange


Ignore:
Timestamp:
06/10/11 14:07:13 (3 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
10bfd1d8f6e1da2ba01e8732203f7bb9e3383715
Message:

ClassifierFromVar and ClassifierFromVarFD used in the trees now set transformUnknowns to false (fixed a problem introduced in rev 9212 in which the default value of transformUnknowns was changed from false to true)

Location:
source/orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/c4.5.cpp

    r7665 r7993  
    709709 
    710710  switch (nodeType) { 
    711     case Branch: 
    712       newNode->branchSelector = mlnew TClassifierFromVar(tested, branchSizes); 
     711    case Branch: { 
     712      TClassifierFromVar *cfv = mlnew TClassifierFromVar(tested, branchSizes); 
     713      cfv->transformUnknowns = false; 
     714      newNode->branchSelector = cfv; 
    713715      newNode->branchDescriptions = mlnew TStringList(tested.AS(TEnumVariable)->values.getReference()); 
    714716      break; 
    715  
    716     case Cut: 
     717    } 
     718 
     719    case Cut: { 
    717720      newNode->branchDescriptions = mlnew TStringList; 
    718721 
     
    725728      dummyVar->values->push_back(str); 
    726729 
    727       newNode->branchSelector = mlnew TClassifierFromVar(wdummyVar, tested, branchSizes, mlnew TThresholdDiscretizer(cut)); 
     730       
     731      TClassifierFromVar *cfv = mlnew TClassifierFromVar(wdummyVar, tested, branchSizes, mlnew TThresholdDiscretizer(cut)); 
     732      cfv->transformUnknowns = false; 
     733      newNode->branchSelector = cfv; 
    728734      break; 
    729  
    730     case Subset: 
     735    } 
     736 
     737    case Subset: { 
    731738      int noval = 1 + *max_element(mapping->begin(), mapping->end()); 
    732739      dummyVar->values = mlnew TStringList(noval, ""); 
     
    745752          *vi = "in [" + *vi + "]"; 
    746753 
    747       newNode->branchSelector = mlnew TClassifierFromVar(wdummyVar, tested, branchSizes,mlnew TMapIntValue(mapping)); 
     754      TClassifierFromVar *cfv = mlnew TClassifierFromVar(wdummyVar, tested, branchSizes,mlnew TMapIntValue(mapping)); 
     755      cfv->transformUnknowns = false; 
     756      newNode->branchSelector = cfv; 
    748757      newNode->branchDescriptions = dummyVar->values; 
    749758      break; 
     759    } 
    750760  } 
    751761 
  • source/orange/tdidt_split.cpp

    r7665 r7993  
    277277  spentAttribute = bestAttr; 
    278278 
    279   return mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     279  TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     280  cfv->transformUnknowns = false; 
     281  return cfv; 
    280282} 
    281283 
     
    517519    spentAttribute = bestAttr; 
    518520    descriptions = mlnew TStringList(attribute.AS(TEnumVariable)->values.getReference()); 
    519     return mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     521    TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     522    cfv->transformUnknowns = false; 
     523    return cfv; 
    520524  } 
    521525 
     
    545549  bvar->set_name(gen->domain->attributes->at(bestAttr)->get_name()); 
    546550  spentAttribute = (ns0==1) && (ns1==1) ? bestAttr : -1; 
    547   return mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TMapIntValue(bestMapping)); 
     551  TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TMapIntValue(bestMapping)); 
     552  cfv->transformUnknowns = false; 
     553  return cfv; 
    548554} 
    549555 
     
    742748    spentAttribute = bestAttr; 
    743749    descriptions = mlnew TStringList(attribute.AS(TEnumVariable)->values.getReference()); 
    744     return mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     750    TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(attribute, gen->domain, bestAttr, subsetSizes); 
     751    cfv->transformUnknowns = false; 
     752    return cfv; 
    745753  } 
    746754 
     
    756764  bestMapping->at(bestValue) = 1; 
    757765  spentAttribute = -1; 
    758   return mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TMapIntValue(bestMapping)); 
     766  TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TMapIntValue(bestMapping)); 
     767  cfv->transformUnknowns = false; 
     768  return cfv; 
    759769} 
    760770 
     
    864874  bvar->set_name(gen->domain->attributes->at(bestAttr)->get_name()); 
    865875  spentAttribute = -1; 
    866   return mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TThresholdDiscretizer(bestThreshold)); 
     876  TClassifierFromVarFD *cfv = mlnew TClassifierFromVarFD(bvar, gen->domain, bestAttr, subsetSizes, mlnew TThresholdDiscretizer(bestThreshold)); 
     877  cfv->transformUnknowns = false; 
     878  return cfv; 
    867879} 
    868880 
Note: See TracChangeset for help on using the changeset viewer.