summaryrefslogtreecommitdiff
path: root/gi/pyp-topics/src/pyp-topics.cc
diff options
context:
space:
mode:
authorphilblunsom <philblunsom@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-23 16:04:32 +0000
committerphilblunsom <philblunsom@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-23 16:04:32 +0000
commite0bca5fea3b0267819186d0fc34c036e6b77679c (patch)
tree5461a308d1a0f848a692ddcff5852c2c8d880089 /gi/pyp-topics/src/pyp-topics.cc
parent04cce54639520ca6a8175194a463d0f5297b01b5 (diff)
Changed the initialisation of the sampler, hopefully this will work better.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@376 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics/src/pyp-topics.cc')
-rw-r--r--gi/pyp-topics/src/pyp-topics.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gi/pyp-topics/src/pyp-topics.cc b/gi/pyp-topics/src/pyp-topics.cc
index 06499291..4c777f0c 100644
--- a/gi/pyp-topics/src/pyp-topics.cc
+++ b/gi/pyp-topics/src/pyp-topics.cc
@@ -58,7 +58,8 @@ void PYPTopics::sample_corpus(const Corpus& corpus, int samples,
int new_topic = -1;
if (freq > frequency_cutoff
&& (!max_contexts_per_document || term_index < max_contexts_per_document)) {
- new_topic = document_id % m_num_topics;
+ new_topic = sample(document_id, term);
+ //new_topic = document_id % m_num_topics;
// add the new topic to the PYPs
increment(term, new_topic);
@@ -314,7 +315,8 @@ PYPTopics::F PYPTopics::word_pyps_p0(const Term& term, int topic, int level) con
Term backoff_term = (*m_backoff)[term];
if (!m_backoff->is_null(backoff_term)) {
assert (level < m_backoff->order());
- p0 = (1.0/(double)m_backoff->terms_at_level(level))*prob(backoff_term, topic, level+1);
+ //p0 = (1.0/(double)m_backoff->terms_at_level(level))*prob(backoff_term, topic, level+1);
+ p0 = prob(backoff_term, topic, level+1);
}
else
p0 = m_term_p0;