Changeset 868


Ignore:
Timestamp:
Sep 14, 2007, 6:51:04 PM (14 years ago)
Author:
Peter
Message:

fixes ticket:236

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/EnsembleBuilder.cc

    r866 r868  
    9494   
    9595    utility::matrix prediction; 
    96    
    97     const KernelLookup* kernel = dynamic_cast<const KernelLookup*>(&data);   
    98     const MatrixLookupWeighted* mw =
    99       dynamic_cast<const MatrixLookupWeighted*>(&data);   
    100     const MatrixLookup* m = dynamic_cast<const MatrixLookup*>(&data);
    10196
    102     if(kernel) {
    103       for(u_long k=0;k<subset_->size();k++) {       
    104         KernelLookup sub_kernel(*kernel,subset_->training_index(k),true);
    105         classifier(k).predict(sub_kernel,prediction);
    106       }
    107     }
    108     else if(mw) {
    109       for(u_long k=0;k<subset_->size();k++) {
    110         MatrixLookupWeighted sub_matrix(*mw,subset_->training_features(k),true);
    111         classifier(k).predict(sub_matrix,prediction);
    112       }
    113     }
    114     else if(m) {
    115       for(u_long k=0;k<subset_->size();k++) {       
    116         MatrixLookup sub_matrix(*m,subset_->training_features(k),true);
    117         classifier(k).predict(sub_matrix,prediction);       
    118       }
    119     }
    120     else {
    121       std::string str;
    122       str = "Error in NCC::predict: DataLookup2D of unexpected class.";
    123       throw std::runtime_error(str);
     97    for(u_long k=0;k<subset_->size();++k) {       
     98      const DataLookup2D* sub_data =
     99        data.selected(subset_->training_features(k));
     100      assert(sub_data);
     101      classifier(k).predict(*sub_data,prediction);
     102      delete sub_data;
    124103    }
    125104
Note: See TracChangeset for help on using the changeset viewer.