fix now today, try to think how to work tmr

This commit is contained in:
tqchen 2014-08-24 22:08:21 -07:00
parent f62b4a02f9
commit fd03239b77
2 changed files with 7 additions and 2 deletions

View File

@ -208,9 +208,11 @@ struct EvalPrecisionRatio : public IEvaluator{
} }
virtual float Eval(const std::vector<float> &preds, virtual float Eval(const std::vector<float> &preds,
const MetaInfo &info) const { const MetaInfo &info) const {
utils::Assert(preds.size() == info.labels.size(), "label size predict size not match"); utils::Check(info.labels.size() != 0, "label set cannot be empty");
utils::Assert(preds.size() % info.labels.size() == 0,
"label size predict size not match");
std::vector< std::pair<float, unsigned> > rec; std::vector< std::pair<float, unsigned> > rec;
for (size_t j = 0; j < preds.size(); ++j) { for (size_t j = 0; j < info.labels.size(); ++j) {
rec.push_back(std::make_pair(preds[j], j)); rec.push_back(std::make_pair(preds[j], j));
} }
std::sort(rec.begin(), rec.end(), CmpFirst); std::sort(rec.begin(), rec.end(), CmpFirst);

View File

@ -154,6 +154,9 @@ extern "C"{
if (src.info.info.root_index.size() != 0) { if (src.info.info.root_index.size() != 0) {
ret.info.info.root_index.push_back(src.info.info.root_index[ridx]); ret.info.info.root_index.push_back(src.info.info.root_index[ridx]);
} }
if (src.info.info.fold_index.size() != 0) {
ret.info.info.fold_index.push_back(src.info.info.fold_index[ridx]);
}
} }
return p_ret; return p_ret;
} }