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:
authorJohn Langford <jl@hunch.net>2013-02-28 18:53:58 +0400
committerJohn Langford <jl@hunch.net>2013-02-28 18:53:58 +0400
commit235972d7350540876f910fdcf70a3a45fc1e72d8 (patch)
tree30c94beab6ec14336121e0a5afb89d8bfe08b015 /vowpalwabbit/sparse_dense.h
parent3a3ef22f1ffda104a320aec4f67f300ad631a438 (diff)
fixed accumulate bug from alexander.kolesnikoff
Diffstat (limited to 'vowpalwabbit/sparse_dense.h')
-rw-r--r--vowpalwabbit/sparse_dense.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/vowpalwabbit/sparse_dense.h b/vowpalwabbit/sparse_dense.h
index e96ec98c..f6079126 100644
--- a/vowpalwabbit/sparse_dense.h
+++ b/vowpalwabbit/sparse_dense.h
@@ -50,8 +50,8 @@ inline float vec_add_trunc(vw& all, float fx, uint32_t fi) {
inline float vec_add_rescale(vw& all, float fx, uint32_t fi) {
weight* w = &all.reg.weight_vector[fi & all.weight_mask];
float x_abs = fabs(fx);
- if( x_abs > w[all.normalized_idx] ) {
- if( w[all.normalized_idx] > 0. ) {
+ if( x_abs > w[all.normalized_idx] ) {// new scale discovered
+ if( w[all.normalized_idx] > 0. ) {//If the normalizer is > 0 then rescale the weight so it's as if the new scale was the old scale.
float rescale = (w[all.normalized_idx]/x_abs);
w[0] *= (all.adaptive ? rescale : rescale*rescale);
}