summaryrefslogtreecommitdiff
path: root/gi/clda/src/clda.cc
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-25 23:43:30 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-25 23:43:30 +0000
commitf5dbba7e5e17ccb0b1f00e44e8262d8eed43647a (patch)
tree33d03daa4355013e5c2048327a49b51e89de33b9 /gi/clda/src/clda.cc
parente808b3cad4a308039343d39126eb518fc404d987 (diff)
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
Diffstat (limited to 'gi/clda/src/clda.cc')
-rw-r--r--gi/clda/src/clda.cc12
1 files changed, 10 insertions, 2 deletions
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<CCRP<int> > dr(zji.size(), CCRP<int>(disc, beta)); // dr[i] describes the probability of using a topic in document i
- vector<CCRP<int> > wr(num_classes, CCRP<int>(disc, alpha)); // wr[k] describes the probability of generating a word in topic k
+ vector<CCRP<int> > dr(zji.size(), CCRP<int>(1,1,1,1,disc, beta)); // dr[i] describes the probability of using a topic in document i
+ vector<CCRP<int> > wr(num_classes, CCRP<int>(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<int>& 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";