|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.knowceans.topics.cgen.MixNetKernelGenerator
public class MixNetKernelGenerator
reimplementation of generator code for support of: multiple sequences, sparse label indexing, parallelisms, fast sampling state, independent samplers and novel C3 and C5 mixnet structures.
Alternative development method: Start (1) generate existing LDA code programmatically, (2) parametrise the variable names in a MixNet structure that is created programmatically, (3) generalise structures, and (4) hook to mixnet script parser. (5) and (6) are parallel and serial accelerations.
This implementation directly makes use of the mixnet structural primitives, simplifying the generic solver into a straight-forward rule-based system.
Field Summary | |
---|---|
double |
alpha
standard value for alpha |
java.lang.String |
corpus
standard value for corpus |
static boolean |
directAssignments
use direct assignments of samples in edge sequences z[m][n] etc., otherwise use temporary variables hz etc. |
boolean |
fastParallel
generate parallelisation structures (copied counts) |
boolean |
fastSerial
generate a fast sampling state (bounds-based method) |
boolean |
formatCode
whether to format the code, default = true |
boolean |
indepSamplers
generate each variable in its own sampler, ignoring dependencies |
int |
iter
standard value for iterations |
int |
iterq
standard value for query iterations |
int |
K
standard value for K |
boolean |
nameSuffix
add a suffix to the model name of the generated class, indicating independent, serial and parallel accellerations |
int |
parallelMode
parallelisation model: 0 = active waiting, 1 = semaphore |
static boolean |
runModel
whether to directly run the model |
(package private) static java.util.Set<java.lang.String> |
uniqueVars
|
Constructor Summary | |
---|---|
MixNetKernelGenerator(MixNet model)
|
Method Summary | |
---|---|
java.lang.String |
beginClass()
|
java.lang.String |
beginInit(boolean q)
|
java.lang.String |
beginKernel(boolean q)
|
java.lang.String |
beginMain()
|
java.lang.String |
codeName()
get the name as it should be used in the code |
java.lang.String |
computeWeights(MixSequence seq,
boolean q,
java.util.List<MixEdge> eeSamp)
compute the weights for sampling |
java.lang.String |
constructor()
create a standard constructor |
java.lang.String |
declareSelectors(boolean theta,
boolean alpha)
declare all selectors of the associated nodes |
java.lang.String |
endClass()
|
java.lang.String |
endInit(boolean q)
|
java.lang.String |
endKernel(boolean q)
|
java.lang.String |
endMain()
|
java.lang.String |
fields()
generate the fields of a given MN, both for training and querying |
java.lang.String |
generateClassCode(MixNet lda)
|
java.lang.String |
genVars()
creates generic variables |
java.lang.String |
header()
|
java.lang.String |
incTopics(MixSequence seq,
boolean q,
boolean inc,
java.util.List<MixEdge> eeSamp)
decrement topics of this sequence, basically decrementing nodes belonging to the edges ee |
java.lang.String |
init(boolean q)
create an init routine |
java.lang.String |
kernel(boolean q)
generate a calculation kernel |
static void |
main(java.lang.String[] args)
|
java.lang.String |
makeMain()
generate main method with standard calls to include corpus and run training and queries |
java.lang.String |
makePpx()
|
java.lang.String |
makeToString()
|
java.lang.String |
printWeights(MixSequence seq,
boolean q,
java.util.List<MixEdge> eeSamp,
boolean mathml)
compute the weights for sampling |
java.lang.String |
sampleTopics(java.util.List<MixEdge> eeSamp,
boolean q)
sample topics of all or active edges |
java.lang.String |
weightsArray()
creates the array for sampling topics |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static java.util.Set<java.lang.String> uniqueVars
public boolean indepSamplers
public boolean formatCode
public boolean fastSerial
public boolean fastParallel
public int parallelMode
TODO: change this to parallelisation modes in thesis
public static boolean directAssignments
public boolean nameSuffix
public static boolean runModel
public int K
public double alpha
public java.lang.String corpus
public int iter
public int iterq
Constructor Detail |
---|
public MixNetKernelGenerator(MixNet model)
Method Detail |
---|
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public java.lang.String generateClassCode(MixNet lda)
public java.lang.String beginClass()
public java.lang.String makeMain()
public java.lang.String codeName()
public java.lang.String beginMain()
public java.lang.String endMain()
public java.lang.String endClass()
public java.lang.String header()
public java.lang.String fields()
public java.lang.String genVars()
u
-
public java.lang.String weightsArray()
u
-
public java.lang.String declareSelectors(boolean theta, boolean alpha)
public java.lang.String constructor()
public java.lang.String init(boolean q)
q
- for querying
public java.lang.String beginInit(boolean q)
u
- q
- for querying
public java.lang.String endInit(boolean q)
public java.lang.String kernel(boolean q)
public java.lang.String beginKernel(boolean q)
public java.lang.String endKernel(boolean q)
public java.lang.String computeWeights(MixSequence seq, boolean q, java.util.List<MixEdge> eeSamp)
sequence
- u
- q
- eeSamp
- if non-null, the edges to sample, otherwise all edges
public java.lang.String sampleTopics(java.util.List<MixEdge> eeSamp, boolean q)
u
- eeSamp
- active edges
public java.lang.String incTopics(MixSequence seq, boolean q, boolean inc, java.util.List<MixEdge> eeSamp)
u
- q
- inc
- false for decee
- list of active edges
public java.lang.String makePpx()
public java.lang.String makeToString()
public java.lang.String printWeights(MixSequence seq, boolean q, java.util.List<MixEdge> eeSamp, boolean mathml)
sequence
- u
- q
- eeSamp
- if non-null, the edges to sample, otherwise all edgesmathml
- or latex (if false)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |