Changeset 1076 for trunk/yat/classifier


Ignore:
Timestamp:
Feb 12, 2008, 2:51:11 PM (13 years ago)
Author:
Markus Ringnér
Message:

NCC done for ticket:259

File:
1 edited

Legend:

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

    r1050 r1076  
    198198        }
    199199        for(size_t c=0;c<target_.nof_classes();c++) {
    200           (*centroids_)(i,c) = class_averager[c].mean();
    201           if(class_averager[c].sum_w()==0)
     200          if(class_averager[c].sum_w()==0) {
    202201            centroids_nan_=true;
     202            (*centroids_)(i,c) = std::numeric_limits<double>::quiet_NaN();
     203          }
     204          else {
     205            (*centroids_)(i,c) = class_averager[c].mean();
     206          }
    203207        }
    204208      }
     
    235239    if (const MatrixLookup* test_unweighted =
    236240        dynamic_cast<const MatrixLookup*>(&test)) {
    237       // If weighted training data resulting in NaN in centroids: weighted calculations
     241      // If weighted training data has resulted in NaN in centroids: weighted calculations
    238242      if(centroids_nan_) {
    239         //        predict_weighted(MatrixLookupWeighted(*test_unweighted),prediction);
    240         std::string str =
    241         "Error in NCC<Distance>::predict: weighted training unweighted test not implemented yet";
    242       throw std::runtime_error(str);
     243        predict_weighted(MatrixLookupWeighted(*test_unweighted),prediction);
    243244      }
    244245      // If unweighted training data: unweighted calculations
Note: See TracChangeset for help on using the changeset viewer.