diff options
author | John Langford <jl@hunch.net> | 2011-07-18 10:57:40 +0400 |
---|---|---|
committer | John Langford <jl@hunch.net> | 2011-07-18 10:57:40 +0400 |
commit | 280b23d4a1ad20bfdc90eaab7af2a087b449e377 (patch) | |
tree | 7a3740f0091c4c768ceb3a333840e5bf78d3a0aa /parse_regressor.cc | |
parent | 6cb47949f15cfad879976775ae20c733909e9518 (diff) |
improved per-feature regularization from Olivier
Diffstat (limited to 'parse_regressor.cc')
-rw-r--r-- | parse_regressor.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/parse_regressor.cc b/parse_regressor.cc index e4ff2c13..1a7aa592 100644 --- a/parse_regressor.cc +++ b/parse_regressor.cc @@ -31,7 +31,7 @@ void initialize_regressor(regressor &r) { r.weight_vectors[i] = (weight *)calloc(global.stride*length/num_threads, sizeof(weight)); if (r.regularizers != NULL) - r.regularizers[i] = (weight *)calloc(length/num_threads, sizeof(weight)); + r.regularizers[i] = (weight *)calloc(2*length/num_threads, sizeof(weight)); if (r.weight_vectors[i] == NULL || (r.regularizers != NULL && r.regularizers[i] == NULL)) { cerr << global.program_name << ": Failed to allocate weight array: try decreasing -b <bits>" << endl; @@ -299,6 +299,8 @@ void dump_regressor(string reg_name, regressor &r, bool as_text, bool reg_vector uint32_t length = 1 << global.num_bits; size_t num_threads = global.num_threads(); size_t stride = global.stride; + if (reg_vector) + length *= 2; for(uint32_t i = 0; i < length; i++) { if (global.lda == 0) |