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>2011-07-11 20:29:33 +0400
committerJohn Langford <jl@hunch.net>2011-07-11 20:29:33 +0400
commit552ca37e664113dea2116ded59961c03132b072d (patch)
treead95294e2747c1fc6d87d50bf84e5f1916d20a30 /lda_core.cc
parentfe0e8612e3a2bbe7102c9c1e4dd381dc7d84d02c (diff)
added Pauls range limit patch
Diffstat (limited to 'lda_core.cc')
-rw-r--r--lda_core.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/lda_core.cc b/lda_core.cc
index 60cb449e..f5895451 100644
--- a/lda_core.cc
+++ b/lda_core.cc
@@ -589,7 +589,7 @@ void start_lda(gd_thread_params t)
continue;
last_weight_index = s->f.weight_index;
float* weights_for_w = &(weights[s->f.weight_index & global.thread_mask]);
- float decay = fmin(1.0, exp(decay_levels.end[-2] - decay_levels.end[(int)(-1-example_t+weights_for_w[global.lda])]));
+ float decay = fmax(0.0, fmin(1.0, exp(decay_levels.end[-2] - decay_levels.end[(int)(-1-example_t+weights_for_w[global.lda])])));
float* u_for_w = weights_for_w + global.lda+1;
weights_for_w[global.lda] = example_t;
@@ -645,7 +645,7 @@ void start_lda(gd_thread_params t)
{
for (size_t i = 0; i < global.length(); i++) {
weight* weights_for_w = & (weights[i*global.stride]);
- float decay = fmin(1.0, exp(decay_levels.last() - decay_levels.end[(int)(-1-example_t+weights_for_w[global.lda])]));
+ float decay = fmax(0.0, fmin(1.0, exp(decay_levels.last() - decay_levels.end[(int)(-1-example_t+weights_for_w[global.lda])])));
for (size_t k = 0; k < global.lda; k++) {
weights_for_w[k] *= decay;
}