| 6 | using namespace std; |
| 7 | |
| 8 | HDPModelObject::HDPModelObject(size_t tw, size_t minCnt, size_t minDf, size_t rmTop, |
| 9 | size_t initialK, float alpha, float eta, float gamma, |
| 10 | PyObject* seed, PyObject* corpus, PyObject* transform) |
| 11 | { |
| 12 | tomoto::HDPArgs margs; |
| 13 | margs.k = initialK; |
| 14 | margs.alpha[0] = alpha; |
| 15 | margs.eta = eta; |
| 16 | margs.gamma = gamma; |
| 17 | if (seed && seed != Py_None && !py::toCpp<size_t>(seed, margs.seed)) |
| 18 | { |
| 19 | throw py::ValueError{ "`seed` must be an integer or None." }; |
| 20 | } |
| 21 | |
| 22 | inst = tomoto::IHDPModel::create((tomoto::TermWeight)tw, margs); |
| 23 | if (!inst) throw py::ValueError{ "unknown `tw` value" }; |
| 24 | isPrepared = false; |
| 25 | seedGiven = !!seed; |
| 26 | minWordCnt = minCnt; |
| 27 | minWordDf = minDf; |
| 28 | removeTopWord = rmTop; |
| 29 | insertCorpus(corpus, transform); |
| 30 | } |
| 31 | |
| 32 | bool HDPModelObject::isLiveTopic(size_t topicId) const |
| 33 | { |
nothing calls this directly
no outgoing calls
no test coverage detected