Changeset 1027 for trunk/yat/classifier


Ignore:
Timestamp:
Feb 2, 2008, 10:29:29 PM (13 years ago)
Author:
Peter
Message:

going back to previous design in which view and const_view are in different classes. Having them in same didnt work as expected. There is a problem converting vector::iterator to vector::const_iterator. I'll open a separate ticket for this issue.

Location:
trunk/yat/classifier
Files:
2 edited

Legend:

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

    r1009 r1027  
    261261    for(size_t sample=0;sample<distances->columns();sample++) {
    262262      std::vector<size_t> k_index;
    263       utility::sort_smallest_index(k_index,k_,distances->column_vec(sample));
     263      utility::sort_smallest_index(k_index,k_,
     264                                   distances->column_const_vec(sample));
    264265      for(size_t j=0;j<k_index.size();j++) {
    265266        prediction(target_(k_index[j]),sample)++;
  • trunk/yat/classifier/NBC.cc

    r1009 r1027  
    207207    for (size_t i=0; i<prediction.rows(); ++i){
    208208      prediction.row_vec(i) *=
    209         1.0/sum(
    210                 prediction.row_vec(i)
    211                 );
     209        1.0/sum(prediction.row_const_vec(i));
    212210    }
    213211  }
Note: See TracChangeset for help on using the changeset viewer.