Changeset 8035:4f7caa5243b7 in orange


Ignore:
Timestamp:
06/28/11 14:26:56 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
31bee3d2b6d4141d065b7cacd77b3c6e48c8e3e2
Message:

Fixed Preprocessor_discretize to respect the discretize_class argument.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/preprocessors.cpp

    r7665 r8035  
    865865  const TDomain &domain = gen->domain.getReference(); 
    866866   
    867   const_PITERATE(TVarList, vi, domain.variables) 
     867  const_PITERATE(TVarList, vi, domain.attributes) 
    868868    if (   ((*vi)->varType == TValue::FLOATVAR) 
    869869        && (   !attributes || !attributes->size()  
     
    879879    } 
    880880 
    881   if (gen->domain->classVar) { 
    882     newDomain->classVar = newDomain->variables->back(); 
    883     newDomain->attributes->erase(newDomain->attributes->end()-1); 
     881  // classVar discretization 
     882  if (domain.classVar){ 
     883      if (domain.classVar->varType == TValue::FLOATVAR 
     884          && (   !attributes || !attributes->size() 
     885                     || exists(attributes->begin(), attributes->end(), *vi)) 
     886          && discretizeClass) { 
     887               PVariable evar = method->operator()(gen, domain.classVar); 
     888               newDomain->variables->push_back(evar); 
     889               newDomain->classVar = evar; 
     890               discretized.push_back(evar); 
     891             } 
     892             else { 
     893               newDomain->variables->push_back(domain.classVar); 
     894               newDomain->classVar = domain.classVar; 
     895             } 
    884896  } 
    885897   
Note: See TracChangeset for help on using the changeset viewer.