diff options
author | John Langford <jl@nyclamp.(none)> | 2014-11-16 02:00:13 +0300 |
---|---|---|
committer | John Langford <jl@nyclamp.(none)> | 2014-11-16 02:00:13 +0300 |
commit | 7c7cf05d47d1685eb9a4509e50fb2a88df637eb2 (patch) | |
tree | 12802668893e96a0e0316bb1fccc402c695e1778 /vowpalwabbit/oaa.cc | |
parent | bd5c388e8297666e48a9cfe190a0de8120728e6c (diff) |
typing label, first compiling version
Diffstat (limited to 'vowpalwabbit/oaa.cc')
-rw-r--r-- | vowpalwabbit/oaa.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/vowpalwabbit/oaa.cc b/vowpalwabbit/oaa.cc index f2504b33..1042956b 100644 --- a/vowpalwabbit/oaa.cc +++ b/vowpalwabbit/oaa.cc @@ -12,6 +12,7 @@ license as described in the file LICENSE. #include "multiclass.h" #include "simple_label.h" #include "reductions.h" +#include "vw.h" using namespace std; using namespace LEARNER; @@ -27,12 +28,12 @@ namespace OAA { template <bool is_learn> void predict_or_learn(oaa& o, learner& base, example& ec) { - multiclass* mc_label_data = (multiclass*)ec.ld; - if (mc_label_data->label == 0 || (mc_label_data->label > o.k && mc_label_data->label != (uint32_t)-1)) - cout << "label " << mc_label_data->label << " is not in {1,"<< o.k << "} This won't work right." << endl; + multiclass mc_label_data = ec.l.multi; + if (mc_label_data.label == 0 || (mc_label_data.label > o.k && mc_label_data.label != (uint32_t)-1)) + cout << "label " << mc_label_data.label << " is not in {1,"<< o.k << "} This won't work right." << endl; - label_data simple_temp = {0.f, mc_label_data->weight, 0.f, 0.f}; - ec.ld = &simple_temp; + label_data simple_temp = {0.f, mc_label_data.weight, 0.f, 0.f}; + ec.l.simple = simple_temp; string outputString; stringstream outputStringStream(outputString); @@ -43,7 +44,7 @@ namespace OAA { { if (is_learn) { - if (mc_label_data->label == i) + if (mc_label_data.label == i) simple_temp.label = 1; else simple_temp.label = -1; @@ -64,8 +65,8 @@ namespace OAA { outputStringStream << i << ':' << ec.partial_prediction; } } - mc_label_data->prediction = prediction; - ec.ld = mc_label_data; + mc_label_data.prediction = prediction; + ec.l.multi = mc_label_data; if (o.shouldOutput) o.all->print_text(o.all->raw_prediction, outputStringStream.str(), ec.tag); |