diff options
author | John Langford <jl@hunch.net> | 2014-03-27 19:03:32 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2014-03-27 19:03:32 +0400 |
commit | 05f7e5110a7b038e056d794a9edc710d64090f7b (patch) | |
tree | d95df9828f545598fa0b7ddadc7857d49f95606a /vowpalwabbit/multiclass.cc | |
parent | d639c86415e89d5df6f9df409e8bec4bb7570662 (diff) |
more minor refactoring
Diffstat (limited to 'vowpalwabbit/multiclass.cc')
-rw-r--r-- | vowpalwabbit/multiclass.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vowpalwabbit/multiclass.cc b/vowpalwabbit/multiclass.cc index 4be1e25a..7da06cb1 100644 --- a/vowpalwabbit/multiclass.cc +++ b/vowpalwabbit/multiclass.cc @@ -1,8 +1,11 @@ +#include <limits.h> #include "multiclass.h" +#include "global_data.h" +#include "vw.h" namespace MULTICLASS { - char* bufread_label(mc_label* ld, char* c) + char* bufread_label(mc_label* ld, char* c) { ld->label = *(uint32_t *)c; c += sizeof(ld->label); @@ -10,7 +13,7 @@ namespace MULTICLASS { c += sizeof(ld->weight); return c; } - + size_t read_cached_label(shared_data*, void* v, io_buf& cache) { mc_label* ld = (mc_label*) v; @@ -19,16 +22,16 @@ namespace MULTICLASS { if (buf_read(cache, c, total) < total) return 0; c = bufread_label(ld,c); - + return total; } - + float weight(void* v) { mc_label* ld = (mc_label*) v; return (ld->weight > 0) ? ld->weight : 0.f; } - + char* bufcache_label(mc_label* ld, char* c) { *(uint32_t *)c = ld->label; |