Changeset 2132


Ignore:
Timestamp:
Dec 24, 2009, 2:13:05 AM (12 years ago)
Author:
Peter
Message:

fixes #579

Location:
branches/0.5-stable
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/0.5-stable/test/ensemble_test.cc

    r1797 r2132  
    114114  suite.err() << "build ensemble" << std::endl;
    115115  ensemble.build();
     116  utility::Vector out(target.size(),0);
     117  for (size_t i = 0; i<out.size(); ++i) {
     118    out(i)=ensemble.validate()[0][i].mean();
     119  }
     120  statistics::AUC roc;
     121  suite.err() << roc.score(target,out) << std::endl;
     122
    116123  std::vector<std::vector<statistics::Averager> > result;
    117124  ensemble.predict(kernel_lookup, result);
    118  
    119   utility::Vector out(target.size(),0);
    120   for (size_t i = 0; i<out.size(); ++i)
    121     out(i)=ensemble.validate()[0][i].mean();
    122   statistics::AUC roc;
    123   suite.err() << roc.score(target,out) << std::endl;
     125  for (size_t i = 0; i<result.size(); ++i) {
     126    for (size_t j=0; j<result[0].size(); ++j) {
     127      if (!suite.add(result[i][j].variance() > 0)) {
     128        suite.err() << "error: element " << i << " " << j << "\n";
     129        suite.err() << "expected finite prediction varince\n";
     130        suite.err() << "found: " << result[i][j].variance() << "\n";
     131      }
     132    }
     133  }
    124134
    125135  {
  • branches/0.5-stable/yat/classifier/EnsembleBuilder.h

    r1950 r2132  
    192192      Data sub_data = test_data(data, k);
    193193      classifier(k).predict(sub_data,prediction);
    194     }
    195 
    196     for(size_t i=0; i<prediction.rows();i++)
    197       for(size_t j=0; j<prediction.columns();j++)
    198         result[i][j].add(prediction(i,j));   
     194      for(size_t i=0; i<prediction.rows();i++)
     195        for(size_t j=0; j<prediction.columns();j++)
     196          result[i][j].add(prediction(i,j));   
     197    }
    199198  }
    200199
Note: See TracChangeset for help on using the changeset viewer.