Changeset 8161:5a145afa70f7 in orange


Ignore:
Timestamp:
08/09/11 18:17:32 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
a21bcbd3d0f964c42646ef4d8e8ca001227950ce
Message:

Compute the distributions for all variables (including class), but only use the
attributes in the actual distance computation.
Fixes #832.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/distance.cpp

    r7665 r8161  
    519519    edr->distributions->normalize(); 
    520520   
    521   for(int attrIndex = 0, nAttrs = gen->domain->attributes->size(); attrIndex != nAttrs; attrIndex++) 
     521  for(int attrIndex = 0, nAttrs = gen->domain->variables->size(); attrIndex != nAttrs; attrIndex++) 
    522522    if (domain.variables->at(attrIndex)->varType == TValue::FLOATVAR) { 
    523523      if (bstat) { 
     
    560560  const bool hasDistributions = bool(distributions); 
    561561 
    562   TExample::const_iterator e1i(e1.begin()); 
     562  TExample::const_iterator e1i(e1.begin()), e1end((e1.domain->classVar)? e1.end() - 1: e1.end()); 
    563563  TExample::const_iterator e2i(e2.begin()); 
    564564  TFloatList::const_iterator avgi(averages->begin()), avge(averages->end()), 
     
    571571 
    572572  float dist = 0.0; 
    573   for(; avgi!=avge; e1i++, e2i++, avgi++, nori++, btsi++) { 
     573  for(; e1i!=e1end; e1i++, e2i++, avgi++, nori++, btsi++) { 
    574574    float dd = 0.0; 
    575575    const TValue &v1 = *e1i, &v2 = *e2i; 
Note: See TracChangeset for help on using the changeset viewer.