离线训练模型:
package jgibblda;
public class dd {
public static void main(String[] args) {
LDACmdOption ldaOption = new LDACmdOption();
ldaOption.est = true;
ldaOption.estc = false;
ldaOption.modelName = "model-final";
ldaOption.dir = "F:/LDAWork";
ldaOption.dfile = "test.txt";
ldaOption.alpha = 0.5;
ldaOption.beta = 0.1;
ldaOption.K = 200;
ldaOption.niters = 1000;
ldaOption.savestep=100;
ldaOption.twords=200;
Estimator estimator = new Estimator();
estimator.init(ldaOption);
estimator.estimate();
}
}
在线计算数据:
package jgibblda;
public class onlineuse {
public static void main(String[] args) {
LDACmdOption ldaOption = new LDACmdOption();
ldaOption.inf = true;
ldaOption.estc = false;
ldaOption.dir = "D:/Users/huaiyu/Workspaces/JGibbLDA-v.1.0/test";
ldaOption.modelName = "model-00200";
ldaOption.dfile = "tmp.txt";
Inferencer inferencer = new Inferencer();
inferencer.init(ldaOption);
Model newModel = inferencer.inference();
}
}