Ignore:
Timestamp:
Feb 26, 2008, 9:46:49 AM (14 years ago)
Author:
Markus Ringnér
Message:

Refs. #335, fixed for KNN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/KNN.h

    r1144 r1156  
    245245        (*distances)(i,j) = distance_(training1.begin(), training1.end(),
    246246                                      test1.begin());
     247        // If the distance is NaN (no common variables with non-zero weights),
     248        // the distance is set to infinity to be sorted as a neighbor at the end
     249        if(std::isnan((*distances)(i,j)))
     250          (*distances)(i,j)=std::numeric_limits<double>::infinity();
    247251      }
    248252    }
Note: See TracChangeset for help on using the changeset viewer.