From 8a71c56ee9a59f30fa2a7765905e2b8e9a023025 Mon Sep 17 00:00:00 2001 From: redpony Date: Fri, 25 Jun 2010 01:45:03 +0000 Subject: optionally use unlimited cache git-svn-id: https://ws10smt.googlecode.com/svn/trunk@27 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/clda/src/clda.cc | 2 +- gi/clda/src/crp.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'gi/clda/src') diff --git a/gi/clda/src/clda.cc b/gi/clda/src/clda.cc index 05cbb441..efe666e2 100644 --- a/gi/clda/src/clda.cc +++ b/gi/clda/src/clda.cc @@ -61,13 +61,13 @@ int main(int argc, char** argv) { double alpha = 50.0 / num_classes; vector > dr(zji.size(), CRP(beta)); // dr[i] describes the probability of using a topic in document i vector > wr(num_classes, CRP(alpha)); // wr[k] describes the probability of generating a word in topic k - int random_topic = rng.next() * num_classes; for (int j = 0; j < zji.size(); ++j) { const size_t num_words = wji[j].size(); vector& zj = zji[j]; const vector& wj = wji[j]; zj.resize(num_words); for (int i = 0; i < num_words; ++i) { + int random_topic = rng.next() * num_classes; if (random_topic == num_classes) { --random_topic; } zj[i] = random_topic; const int word = wj[i]; diff --git a/gi/clda/src/crp.h b/gi/clda/src/crp.h index b01a7f47..9d35857e 100644 --- a/gi/clda/src/crp.h +++ b/gi/clda/src/crp.h @@ -3,7 +3,6 @@ // shamelessly adapted from code by Phil Blunsom and Trevor Cohn -#include #include #include -- cgit v1.2.3