From cdfdbd8d9604d0bac5fe40197d1776f42f75ab70 Mon Sep 17 00:00:00 2001 From: redpony Date: Wed, 25 Aug 2010 23:43:30 +0000 Subject: waste of time. priors on PYP hyperparameters with MJ's slice sampler. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@622 ec762483-ff6d-05da-a07a-a48fb63a330f --- gi/clda/src/clda.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gi/clda/src/clda.cc') diff --git a/gi/clda/src/clda.cc b/gi/clda/src/clda.cc index 10056bc9..f548997f 100644 --- a/gi/clda/src/clda.cc +++ b/gi/clda/src/clda.cc @@ -61,8 +61,8 @@ int main(int argc, char** argv) { double alpha = 50.0; const double uniform_topic = 1.0 / num_classes; const double uniform_word = 1.0 / TD::NumWords(); - vector > dr(zji.size(), CCRP(disc, beta)); // dr[i] describes the probability of using a topic in document i - vector > wr(num_classes, CCRP(disc, alpha)); // wr[k] describes the probability of generating a word in topic k + vector > dr(zji.size(), CCRP(1,1,1,1,disc, beta)); // dr[i] describes the probability of using a topic in document i + vector > wr(num_classes, CCRP(1,1,1,1,disc, alpha)); // wr[k] describes the probability of generating a word in topic k for (int j = 0; j < zji.size(); ++j) { const size_t num_words = wji[j].size(); vector& zj = zji[j]; @@ -89,6 +89,13 @@ int main(int argc, char** argv) { total_time += timer.Elapsed(); timer.Reset(); double llh = 0; +#if 1 + for (int j = 0; j < dr.size(); ++j) + dr[j].resample_hyperparameters(&rng); + for (int j = 0; j < wr.size(); ++j) + wr[j].resample_hyperparameters(&rng); +#endif + for (int j = 0; j < dr.size(); ++j) llh += dr[j].log_crp_prob(); for (int j = 0; j < wr.size(); ++j) @@ -120,6 +127,7 @@ int main(int argc, char** argv) { } for (int i = 0; i < num_classes; ++i) { cerr << "---------------------------------\n"; + cerr << " final PYP(" << wr[i].discount() << "," << wr[i].concentration() << ")\n"; ShowTopWordsForTopic(t2w[i]); } cerr << "-------------\n"; -- cgit v1.2.3