本文整理汇总了C++中Corpus::Len方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpus::Len方法的具体用法?C++ Corpus::Len怎么用?C++ Corpus::Len使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpus
的用法示例。
在下文中一共展示了Corpus::Len方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LdaApp
void LdaApp() {
long t1;
(void) time(&t1);
seedMT(t1);
float em_converged = 1e-4;
int em_max_iter = FLAGS_em_iterate;
int em_estimate_alpha = 1; //1 indicate estimate alpha and 0 use given value
int var_max_iter = FLAGS_var_iterate;
double var_converged = 1e-6;
double initial_alpha = FLAGS_alpha;
int topic = FLAGS_topic_num;
Corpus train;
Corpus test;
train.LoadData(FLAGS_cor_train);
test.LoadData(FLAGS_cor_test);
LOG(INFO) << train.Len()<< " " << test.Len();
LdaModel m;
LDA lda;
lda.Init(em_converged, em_max_iter, em_estimate_alpha, var_max_iter,
var_converged, initial_alpha, topic);
Str type = "seeded";
lda.RunEM(type, train, test, &m);
VVReal gamma;
VVVReal phi;
lda.Infer(test, m, &gamma, &phi);
WriteStrToFile(Join(gamma, " ", "\n"), "./model/gamma");
WriteStrToFile(Join(m.log_prob_w, topic, train.num_terms), "./model/beta");
WriteStrToFile(Join(phi, " ", "\n", "\n\n"), "./model/phi");
}