ext/tomoto/dt.cpp in tomoto-0.1.4 vs ext/tomoto/dt.cpp in tomoto-0.2.0
- old
+ new
@@ -8,14 +8,23 @@
Rice::define_class_under<tomoto::IDTModel, tomoto::ILDAModel>(m, "DT")
.define_singleton_method(
"_new",
*[](size_t tw, size_t k, size_t t, tomoto::Float alphaVar, tomoto::Float etaVar, tomoto::Float phiVar, tomoto::Float shapeA, tomoto::Float shapeB, tomoto::Float shapeC) {
// Rice only supports 10 arguments
- int seed = -1;
- if (seed < 0) {
- seed = std::random_device{}();
+ size_t seed = -1;
+ tomoto::DTArgs args;
+ args.k = k;
+ args.t = t;
+ args.alpha = {alphaVar};
+ args.eta = etaVar;
+ args.phi = phiVar;
+ args.shapeA = shapeA;
+ args.shapeB = shapeB;
+ args.shapeC = shapeC;
+ if (seed >= 0) {
+ args.seed = seed;
}
- return tomoto::IDTModel::create((tomoto::TermWeight)tw, k, t, alphaVar, etaVar, phiVar, shapeA, shapeB, shapeC, 0, seed);
+ return tomoto::IDTModel::create((tomoto::TermWeight)tw, args);
})
.define_method(
"_add_doc",
*[](tomoto::IDTModel& self, std::vector<std::string> words, uint32_t timepoint) {
auto doc = buildDoc(words);