|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.knowceans.dirichlet.lda.LdaGibbsSampler org.knowceans.dirichlet.lda.LdaGibbsQuerySampler
public class LdaGibbsQuerySampler
LdaGibbsQuerySampler allows sampling from known markov states, i.e., the model of a corpus, which can be used to predict the topics of query documents.
Field Summary | |
---|---|
private static long |
serialVersionUID
|
(package private) LdaMarkovState |
stateq
stateq contains the query documents. |
(package private) LdaMarkovState |
stateSave
stateSave contains the saved markov state (after initially loading the state. |
private double[][] |
thetasumq
|
Fields inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
---|
backupIteration, conf, dispcol, numstats, phisum, rand, state, thetasum |
Constructor Summary | |
---|---|
LdaGibbsQuerySampler(LdaMarkovState state,
ExtLdaConfiguration conf,
boolean restorable)
Initialise the gibbs sampler with a known markov state (for querying). |
|
LdaGibbsQuerySampler(LdaMarkovState state,
ExtLdaConfiguration conf,
java.util.Random rand,
boolean restorable)
Initialise the gibbs sampler with a known markov state (for querying). |
Method Summary | |
---|---|
double[][] |
getPredictiveTheta()
Get the document--topic associations of the query documents. |
double[][] |
getSavedPhi()
Get the backed up phi (without influence of the queries). |
protected void |
gibbs()
Main method: Select initial state ? |
private void |
initialState(boolean restorable)
Initialisation: initialise the sampler from a known state of the markov chain for querying the model. |
double[] |
query(int[] document)
Initialise the sampler with a one-document query. |
double[][] |
query(int[][] query)
Initialise the gibbs sampler with the query documents |
void |
restore()
For restorable state operation, restore (reinitialise) the state to that of the markov chain at object creation time. |
protected void |
updateTheta()
Add to the statistics the values of theta for the current state. |
Methods inherited from class org.knowceans.dirichlet.lda.LdaGibbsSampler |
---|
getPhi, getState, getTheta, gibbs, gibbsHeap, gibbsHeap, initialState, load, main, output, run, sampleCorpus, sampleLdaFullConditional, save, saveState, updateParams, updatePhi, writeParameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
LdaMarkovState stateq
LdaMarkovState stateSave
private double[][] thetasumq
Constructor Detail |
---|
public LdaGibbsQuerySampler(LdaMarkovState state, ExtLdaConfiguration conf, boolean restorable)
state
- conf
- public LdaGibbsQuerySampler(LdaMarkovState state, ExtLdaConfiguration conf, java.util.Random rand, boolean restorable)
state
- conf
- rand
- restorable
- whether the initial markov state can be restored using
restore (see there).Method Detail |
---|
private void initialState(boolean restorable)
restorable
- whether the initial markov state can be restored using
restore (see there).public double[] query(int[] document)
document
-
public double[][] query(int[][] query)
query
- word vectors
public void restore()
Because the association counts are influenced by the queries, the original state of the markov chain becomes "dirty". Therefore, this state can be backed up by enabling the argument restorable in the constructors.
protected void updateTheta()
updateTheta
in class LdaGibbsSampler
public double[][] getPredictiveTheta()
public double[][] getSavedPhi()
protected void gibbs()
LdaGibbsSampler
gibbs
in class LdaGibbsSampler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |