diff options
author | John Langford <jl@humpty.(none)> | 2010-11-25 01:08:14 +0300 |
---|---|---|
committer | John Langford <jl@humpty.(none)> | 2010-11-25 01:08:14 +0300 |
commit | f1697e625310cd31869b8c26350cbc723f88ecda (patch) | |
tree | 36f55e0aa393a1cf22058afc9b1235b181a9f3d1 /parser.cc | |
parent | bff315972c2c4587366d61095a239ab6605293bb (diff) |
redo adaptive so the regressor is binary compatible
Diffstat (limited to 'parser.cc')
-rw-r--r-- | parser.cc | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -19,6 +19,7 @@ namespace po = boost::program_options; #include "multisource.h" #include "comp_io.h" #include "unique_sort.h" +#include "constant.h" parser* new_parser(const label_parser* lp) { @@ -538,21 +539,24 @@ void setup_example(parser* p, example* ae) p->t += ae->global_weight; ae->example_t = p->t; - if(global.adaptive) //make room for learning rates + //add constant feature + size_t constant_namespace = 128; + push(ae->indices,constant_namespace); + feature temp = {1,constant}; + push(ae->atomics[constant_namespace], temp); + + if(global.stride != 1) //make room for per-feature information. { + size_t stride = global.stride; for (size_t* i = ae->indices.begin; i != ae->indices.end; i++) for(feature* j = ae->atomics[*i].begin; j != ae->atomics[*i].end; j++) - j->weight_index = (j->weight_index << 1) & global.mask; - ae->sorted = false; + j->weight_index = (j->weight_index*stride) & global.mask; if (global.audit) for (size_t* i = ae->indices.begin; i != ae->indices.end; i++) for(audit_data* j = ae->audit_features[*i].begin; j != ae->audit_features[*i].end; j++) - j->weight_index = (j->weight_index << 1) & global.mask; + j->weight_index = (j->weight_index*stride) & global.mask; } - - if (!ae->sorted && global.partition_bits > 0) - unique_sort_features(ae); - + //Should loop through the features to determine the boundaries size_t length = global.mask + 1; size_t expert_size = length >> global.partition_bits; //#features/expert |