Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal Daume III <me@hal3.name>2014-04-29 22:22:56 +0400
committerHal Daume III <me@hal3.name>2014-04-29 22:22:56 +0400
commitee723e7354b9dda945f7274a8a7541ad8d435002 (patch)
tree2a4a45fce33a26ec3a86f79f7539804bdcb12bfa /vowpalwabbit/csoaa.cc
parenta72e5934c4f23b2b3184877508c353bad63aba4d (diff)
adjusted csoaa/cost_sensitive for new method of doing shared features / label dictionary
Diffstat (limited to 'vowpalwabbit/csoaa.cc')
-rw-r--r--vowpalwabbit/csoaa.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/vowpalwabbit/csoaa.cc b/vowpalwabbit/csoaa.cc
index 8c91c5a3..5c88c915 100644
--- a/vowpalwabbit/csoaa.cc
+++ b/vowpalwabbit/csoaa.cc
@@ -120,23 +120,24 @@ namespace LabelDict {
size_t hash_lab(size_t lab) { return 328051 + 94389193 * lab; }
- bool ec_is_label_definition(example& ec) // label defs look like "___:-1"
+ bool ec_is_label_definition(example& ec) // label defs look like "0:___" or just "label:___"
{
- v_array<COST_SENSITIVE::wclass> costs = ((COST_SENSITIVE::label*)ec.ld)->costs;
- for (size_t j=0; j<costs.size(); j++)
- if (costs[j].x >= 0.) return false;
if (ec.indices.size() == 0) return false;
if (ec.indices.size() > 2) 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;
return true;
}
- bool ec_is_example_header(example& ec) // example headers look like "0:-1"
+ bool ec_is_example_header(example& ec) // example headers look like "0:-1" or just "shared"
{
v_array<COST_SENSITIVE::wclass> costs = ((COST_SENSITIVE::label*)ec.ld)->costs;
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;
}