diff options
author | Hal Daume III <me@hal3.name> | 2014-04-29 22:39:40 +0400 |
---|---|---|
committer | Hal Daume III <me@hal3.name> | 2014-04-29 22:39:40 +0400 |
commit | 6eb13811f2eeccb227154229a3dd00d7fa251774 (patch) | |
tree | cb3aeb1599ed7c7f671643e244dd8abfb0721365 /vowpalwabbit/csoaa.cc | |
parent | ee723e7354b9dda945f7274a8a7541ad8d435002 (diff) |
fixed bugs from previous commit
Diffstat (limited to 'vowpalwabbit/csoaa.cc')
-rw-r--r-- | vowpalwabbit/csoaa.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/vowpalwabbit/csoaa.cc b/vowpalwabbit/csoaa.cc index 5c88c915..9df140ee 100644 --- a/vowpalwabbit/csoaa.cc +++ b/vowpalwabbit/csoaa.cc @@ -122,12 +122,11 @@ namespace LabelDict { bool ec_is_label_definition(example& ec) // label defs look like "0:___" or just "label:___" { - if (ec.indices.size() == 0) return false; - if (ec.indices.size() > 2) return false; + if (ec.indices.size() != 1) return false; if (ec.indices[0] != 'l') return false; v_array<COST_SENSITIVE::wclass> costs = ((COST_SENSITIVE::label*)ec.ld)->costs; for (size_t j=0; j<costs.size(); j++) - if ((costs[j].class_index == 0) && (costs[j].x > 0.)) return true; + if ((costs[j].class_index != 0) || (costs[j].x <= 0.)) return false; return true; } @@ -137,7 +136,6 @@ namespace LabelDict { if (costs.size() != 1) return false; if (costs[0].class_index != 0) return false; if (costs[0].x >= 0) return false; - assert(false); return true; } @@ -560,7 +558,7 @@ namespace LabelDict { v_array<COST_SENSITIVE::wclass> costs = ((COST_SENSITIVE::label*)l.ec_seq[i]->ld)->costs; for (size_t j=0; j<costs.size(); j++) { - size_t lab = costs[j].class_index; + size_t lab = (size_t)costs[j].x; LabelDict::set_label_features(l, lab, features); } } |