use of structures._ParentDoc in project IR_Base by Linda-sunshine.
the class ACCTM method computeTestMu4Doc.
protected void computeTestMu4Doc(_ChildDoc d) {
_ParentDoc pDoc = d.m_parentDoc;
double mu = Utils.cosine(d.getSparseVct4Infer(), pDoc.getSparseVct4Infer());
mu = 1e32;
d.setMu(mu);
}
use of structures._ParentDoc in project IR_Base by Linda-sunshine.
the class ACCTM method initTest.
protected void initTest(ArrayList<_Doc> sampleTestSet, _Doc d) {
_ParentDoc pDoc = (_ParentDoc) d;
for (_Stn stnObj : pDoc.getSentences()) {
stnObj.setTopicsVct(number_of_topics);
}
int testLength = 0;
pDoc.setTopics4GibbsTest(number_of_topics, 0, testLength);
sampleTestSet.add(pDoc);
pDoc.createSparseVct4Infer();
for (_ChildDoc cDoc : pDoc.m_childDocs) {
testLength = (int) (m_testWord4PerplexityProportion * cDoc.getTotalDocLength());
cDoc.setTopics4GibbsTest(number_of_topics, 0, testLength);
sampleTestSet.add(cDoc);
cDoc.createSparseVct4Infer();
computeTestMu4Doc(cDoc);
}
}
use of structures._ParentDoc in project IR_Base by Linda-sunshine.
the class ACCTM method collectChildStats.
protected void collectChildStats(_Doc d) {
_ChildDoc cDoc = (_ChildDoc) d;
_ParentDoc pDoc = cDoc.m_parentDoc;
double pDocTopicSum = Utils.sumOfArray(pDoc.m_sstat);
for (int k = 0; k < this.number_of_topics; k++) cDoc.m_topics[k] += cDoc.m_sstat[k] + d_alpha + cDoc.getMu() * pDoc.m_sstat[k] / pDocTopicSum;
}
use of structures._ParentDoc in project IR_Base by Linda-sunshine.
the class ACCTM_C method childTopicInDocProb.
@Override
protected double childTopicInDocProb(int tid, _ChildDoc d) {
_ParentDoc pDoc = d.m_parentDoc;
double pDocTopicSum = Utils.sumOfArray(pDoc.m_sstat);
return (d_alpha + d.getMu() * d.m_parentDoc.m_sstat[tid] / pDocTopicSum + d.m_xTopicSstat[0][tid]) / (m_kAlpha + d.getMu() + d.m_xSstat[0]);
}
use of structures._ParentDoc in project IR_Base by Linda-sunshine.
the class ACCTM_C method initTest.
@Override
protected void initTest(ArrayList<_Doc> sampleTestSet, _Doc d) {
_ParentDoc pDoc = (_ParentDoc) d;
for (_Stn stnObj : pDoc.getSentences()) {
stnObj.setTopicsVct(number_of_topics);
}
// //for conditional perplexity
int testLength = 0;
pDoc.setTopics4GibbsTest(number_of_topics, 0, testLength);
sampleTestSet.add(pDoc);
pDoc.createSparseVct4Infer();
for (_ChildDoc cDoc : pDoc.m_childDocs) {
testLength = (int) (m_testWord4PerplexityProportion * cDoc.getTotalDocLength());
((_ChildDoc4BaseWithPhi) cDoc).createXSpace(number_of_topics, m_gamma.length, vocabulary_size, d_beta);
((_ChildDoc4BaseWithPhi) cDoc).setTopics4GibbsTest(number_of_topics, 0, testLength);
sampleTestSet.add(cDoc);
cDoc.createSparseVct4Infer();
computeTestMu4Doc(cDoc);
}
}
Aggregations